Sytone's Ramblings

The occasional posts of a guy who plays with technology.

Cleanup Empty Azure Resource Groups

2021-06-23 1 min read Azure
I needed to cleanup empty groups on a test subscription I had, using the Azure Cloud shell the following script will do it for you. az group list -o tsv --query [].name | % {$resources = az resource list -g $_ -o table; if($resources) {"$_ has Resources"} else {"$_ has no resources"; az group delete -n $_ -y --no-wait}}