Skip to content

Instantly share code, notes, and snippets.

@bennage
Created April 22, 2021 17:33
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 bennage/0a5ec2fead03151c90eac5205acc6be4 to your computer and use it in GitHub Desktop.
Save bennage/0a5ec2fead03151c90eac5205acc6be4 to your computer and use it in GitHub Desktop.
bash script for deleting all resource groups matching a pattern
#!/usr/bin/env bash
groups=$(az group list --query "[?contains(name,'bennage')].name")
for row in $(echo "${groups}" | jq -r '.[]'); do
_remove() {
echo ${row}
az group delete -y --no-wait -g ${row}
}
echo $(_remove)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment