Created
February 28, 2020 20:55
-
-
Save ninjarobot/d7375c1ffedd4ca1648ec5fe3ae10744 to your computer and use it in GitHub Desktop.
Cleanup ARM deployments
This file contains hidden or 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 | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: deployment-cleanup.sh <subscription_id> <resource_group>" | |
exit 1 | |
fi | |
az group deployment list --subscription $1 -g $2 --query '[].{name:name,ts:properties.timestamp}[*].name' -o tsv | tail -n +100 | xargs -n1 az group deployment delete --subscription $1 -g $2 -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment