Instantly share code, notes, and snippets.

Embed
What would you like to do?
Microsoft Azure: Find out storage accounts that are good to be deleted - http://manesh.me/2015/02/06/cleaning-up-azure-storage-accounts/
# 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