Last active
October 7, 2016 21:31
-
-
Save stephlocke/db3c0d0decc714fe36ee6e1b9770007e to your computer and use it in GitHub Desktop.
How to get container details from a storage account stored in an azure resource group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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