Skip to content

Instantly share code, notes, and snippets.

@gambtho
Created July 25, 2019 15:26
Show Gist options
  • Save gambtho/7b0e1c74bcba26151d02964df2e1c9a6 to your computer and use it in GitHub Desktop.
Save gambtho/7b0e1c74bcba26151d02964df2e1c9a6 to your computer and use it in GitHub Desktop.
clean-up your azure resources
#!/bin/bash
# NOTE: Be careful as this code in intended to delete ALL Resources in a subscription. Use at your own risk.
# https://stackoverflow.com/a/56139987
# Set The correct Subscription
az account set -s "<Subscription_name / Id>"
# Get All resource groups and loop to delete them
for rg_name in `az group list -o tsv --query [*].name`; do
echo Deleting ${rg_name}
az group delete -n ${rg_name} --yes --no-wait
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment