Last active
August 29, 2015 14:14
-
-
Save Manesh-R/34b9153c366a7d749f5f to your computer and use it in GitHub Desktop.
Microsoft Azure: Find out storage accounts that are good to be deleted - http://manesh.me/2015/02/06/cleaning-up-azure-storage-accounts/
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
# Ref: http://manesh.me/2015/02/06/cleaning-up-azure-storage-accounts/ | |
Get-AzureStorageAccount -WarningAction SilentlyContinue | ForEach-Object { | |
$storageAccountName = $_.StorageAccountName | |
$storageAccountKey = (Get-AzureSTorageKey $storageAccountName).Primary | |
$storageContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey | |
Write-Host "" | |
Write-Host "Storage Account : " $storageAccountName | |
Get-AzureStorageContainer -Context $storageContext | ForEach-Object { | |
$containerName = $_.Name; | |
Get-AzureStorageBlob -Container $containerName -Context $storageContext | ForEach-Object { | |
Write-Host $containerName "`t" $_.BlobType "`t" $_.Name | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment