The Remove-AzResourceGroup cmdlet removes an Azure resource group and its resources from the current subscription.
To delete a resource, but leave the resource group, use the Remove-AzResource cmdlet.
Examples
Example 1: Remove a resource group
Remove-AzResourceGroup -Name "ContosoRG01"
This command removes the ContosoRG01 resource group from the subscription.
The cmdlet prompts you for confirmation and returns no output.
Example 2: Remove a resource group without confirmation
This command uses the Get-AzResourceGroup cmdlet to get the resource group ContosoRG01, and then passes it to Remove-AzResourceGroup by using the pipeline operator. The Force parameter suppresses the confirmation prompt.
Example 3: Remove all resource groups
Get-AzResourceGroup | Remove-AzResourceGroup
This command uses the Get-AzResourceGroup cmdlet to get all resource groups, and then passes them to Remove-AzResourceGroup by using the pipeline operator.
Example 4: Remove a resource groups use ForceDeletionType
The resource types you want to force delete.Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.