Skip to content

Instantly share code, notes, and snippets.

@abn
Last active July 25, 2018 12:35
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 abn/a5154b1d80f38b611028c4eb9ad4cd45 to your computer and use it in GitHub Desktop.
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
#!/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