Last active
July 25, 2018 12:35
-
-
Save abn/a5154b1d80f38b611028c4eb9ad4cd45 to your computer and use it in GitHub Desktop.
Azure: List all VHD blobs in all containers in all storage accounts of a specified resource group
This file contains hidden or 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
#!/usr/bin/env bash | |
# This script lists all blobs in all containers in all storage accounts of a specified resource group | |
for storageAccount in `az storage account list -g ${1} | jq -r '.[] | .name'`; do | |
for containerName in `az storage container list --account-name ${storageAccount} | jq -r '.[] | .name'`; do | |
blobName=`az storage blob list -c ${containerName} --account-name ${storageAccount} | jq -r '.[] | .name'` | |
[[ ! -z "${blobName}" ]] && echo "${storageAccount}/${containerName}/${blobName}" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment