Working with Windows Azure Storage –Create Storage Container – PowerShell Part – 3

Continuation  from Part –2. A storage account can contain zero or more containers. A container contains properties, metadata, and zero or more blobs. A blob is any single entity comprised of binary data, properties, and metadata.


Lets create a storage container under storage account we created in Part-2


    1. Open PowerShell window and import the Azure PowerShell Module
image Import-Module “C:Program Files (x86)Microsoft SDKsAzurePowerShell
    1. Import the Credentials Publishing settings
image Import-AzurePublishSettingsFile C:AzureAzure_credentials_file.publishsettings
    1. Get details of Azure Storage Accounts
image Get-AzureStorageAccount | SELECT StorageAccountName,Location,EndPoints |Format-Custom
    1. Create the container under any of the account listed in step3. To create the container you require subscription Name,StorageAccountName,storageaccountkey to create AzureStorageContext.

PS C:> $subscriptionName = “subscription name”
PS C:> $storageAccountName = “storage account name”
PS C:> Select-AzureSubscription $subscriptionName
PS C:> $storageaccountkey = get-azurestoragekey $storageAccountName | %{$_.Primary}
PS C:> $destContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageaccountkey
PS C:> New-AzureStorageContainer testcontainer1 -Permission Off -Context $destContext

Leave a Reply

Your email address will not be published.