Skip to content

Instantly share code, notes, and snippets.

@m-gagne
Last active November 12, 2015 14:16
Show Gist options
  • Save m-gagne/50cee0261e137587ee3c to your computer and use it in GitHub Desktop.
Save m-gagne/50cee0261e137587ee3c to your computer and use it in GitHub Desktop.
Remove all empty Resource Groups in Azure
Switch-AzureMode AzureResourceManager; Get-AzureResourceGroup | Foreach-Object { Get-AzureResourceGroup -Name $_.ResourceGroupName | Where-Object { $_.Resources.Count -eq 0 } | Foreach-Object { Write-Host Removing $_.ResourceGroupName; Remove-AzureResourceGroup -Name $_.ResourceGroupName -Force } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment