I want to delete all the resource groups in a subscription in a single cli command. I used pipeline operator to delete all the resource groups:
(Get-AzResourceGroup | Remove-AzResourceGroup).
While azure deletes the groups sequentially, it prompts for confirmation for each resource group. Is there a way to force delete all resource groups in Azure cli without encountering the confirmation from the CLI.
2
Answers
Please use
-Force
parameter to remove resource group without confirmation.From this
link
:We can use this power shell script to delete all resource groups in a subscription.
Delete All resource groups whose names match with the filter