Created
April 2, 2024 07:48
-
-
Save GuyHarwood/db836abb9500343ae80b45a0fc926341 to your computer and use it in GitHub Desktop.
Delete multiple storage account blob containers via Azure CLI
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
#!/bin/bash | |
set -e | |
if [ -z "$1" ] | |
then | |
echo "storage account name required" | |
exit 1 | |
fi | |
if [ -z "$2" ] | |
then | |
echo "blob container name prefix required" | |
exit 1 | |
fi | |
storageAccountName=$1 | |
containerPrefix=$2 | |
az storage container list --auth-mode login --account-name $storageAccountName --prefix $containerPrefix --query "[].name" --output tsv | xargs -n 1 az storage container delete --account-name $storageAccountName --auth-mode login --name | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment