Deleting all resource groups with a prefix in their name in Azure

One benefit of using a prefix in Azure resource group names is being able to easily remove all resource groups starting with that prefix with a one liner (be very careful with “-y” though):

az group list -o table | grep '^yourprefix' | awk '{system("az group delete -y --no-wait -g "$1)}'

This is of course not limited to resource group names. You can use the same approach for pretty much everything in Azure.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s