If you have set of resource groups created for a project which contains a specific string in their name (say the project code). Then it is very easy to delete them all in a single statement.
To get all the resource groups having rg-delete-
as prefix
Get-AzResourceGroup -Name "rg-delete-*"
After you confirm they are the right set of names then you can delete them all by
Get-AzResourceGroup -Name "rg-delete-*" | Remove-AzResourceGroup -Force -AsJob
You need to use -Force
to avoid any user prompt.
Top comments (0)