Skip to content

Instantly share code, notes, and snippets.

@Manesh-R
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Manesh-R/34b9153c366a7d749f5f to your computer and use it in GitHub Desktop.
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/
# 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