az-destroy.bash deletes Azure resource groups that match a command-line-provided string across Azure Subscriptions. The Azure CLI was used because of it's simple --no-wait flag that parallelizes and runs the command in the background.
- Clone repository to your local system
chmod u+x ./az-destroy.bash- Create a
.gitignoreto prohibitsecrets.bashfrom being commited - Create a secrets file by
cp ./secrets.bash.template ./secrets.bashand update with your Azure Tenant, Subscription and Service Prinicipal information
- bash
- Azure CLI
- A Service Principal that has Subsciption Contributor access to all Subsciptions of interest
- an updated (and .gitignored)
secrets.bash
./az-destroy <resource group name fragment>
Example:
./az-destroy cloud1017
Looking for resource groups starting with cloud1017
RESOURCES TO DELETE:
=> <Subscription ID #1>
==> cloud1017a
==> mycloud1017a
==> cloud1017c
=> <Subscription ID #2>
==> cloud1017b
==> thecloud1017b
IS THIS OKAY? DO YOU WANT TO CONTINUE? (y/n)
Feel free to fork, clone or, if you'd like to contribute back, just issue a PR.
Ray Crawford - Initial work - GitHub
This project is licensed under the MIT License - see the LICENSE.md file for details
- My awesome collegues at Cardinal Solutions Group