Skip to content

Instantly share code, notes, and snippets.

@stephlocke stephlocke/example.ps1
Last active Oct 7, 2016

Embed
What would you like to do?
How to get container details from a storage account stored in an azure resource group
Import-Module AzureRM.Storage
$rgname="group"
$StorageAccountName="storage"
$container="container"
# getting Azure storage account key
$fullkeys = Get-AzureRMStorageAccountKey -StorageAccountName $StorageAccountName -ResourceGroupName $rgname
# the script will be using primary key
$key = $fullkeys[0].Value
## OLD (pre v1.4.0)
## $key = $fullkeys.Key1 # this differs to the Get-AzureStorageAccountKey cmdlet's output!
# getting storage account content
$context = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $key
# find my container
Get-AzureStorageContainer -Context $context -Name $container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.