By using AzurePowershell command we can create Azure StorageAccount,Container and we can upload BLOB to Azure.


New-AzureRmStorageAccount `
-ResourceGroupName 20533D0101-LabRG `
-Name "bookch4pss" `
-Location "eastus" `
-SkuName Standard_LRS `
-Kind Storage

#Get teh key of StorageAccount
$mystorekey=(Get-AzureRmStorageAccountKey `
-ResourceGroupName 20533D0101-LabRG `
-Name $StorageAccountName)
$mystorekey.value

#Variable declarations for StorageAccountName and StorageAccountKey
$StorageAccountName="bookch4pss"
$StorageAccountKey="Provide the second value from above $mystorekey"

#Definig storage account context using storage account name
$ctx=New-AzureStorageContext `
-StorageAccountName $StorageAccountName `
-StorageAccountKey $StorageAccountKey

#Need to create a value and name to the container
$ContainerName="test-ps"

#Create a new container with public access to the blobs
New-AzureStorageContainer `
-Name $ContainerName `
-Context $ctx `
-Permission Blob

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server