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}}