Skip to content

Instantly share code, notes, and snippets.

@anyhotcountry
Created June 27, 2019 14:45
Show Gist options
  • Save anyhotcountry/628c11c9bff5caed529b8058ad449cf8 to your computer and use it in GitHub Desktop.
Save anyhotcountry/628c11c9bff5caed529b8058ad449cf8 to your computer and use it in GitHub Desktop.
az cli delete all resource groups without locks
for i in `az group list -o tsv --query [].name`; do if [ "$(az lock list -g $i -o tsv --query [].name)" ]; then echo "$i have a lock"; else az group delete -n $i -y --no-wait; fi; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment