Remove-AzResourceGroup

Removes a resource group.

SYNOPSIS

Removes a resource group.

SYNTAX

Remove-AzResourceGroup -Name <String> [-Force] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>] Remove-AzResourceGroup -InputObject <PSObject> [-Force] [-AsJob] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Remove-AzResourceGroup cmdlet deletes a resource group and its resources.

By default, this cmdlet prompts for confirmation before it removes the resource group.

PARAMETERS

Name Type Description
-Name String Specifies the name of the resource group to remove.
-InputObject PSObject Specifies the resource group object to remove. You can use the pipeline operator to pass a resource group object to this cmdlet.
-Force SwitchParameter Forces the removal of the resource group without prompting for confirmation.
-AsJob SwitchParameter Runs the cmdlet as a background job. Use this parameter to run the cmdlet that returns immediately instead of waiting for the command to complete.
-WhatIf SwitchParameter Shows what would happen if the cmdlet runs. The cmdlet is not run.
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.

EXAMPLES

Example 1: Remove a resource group

This command removes the resource group named "resourceGroup11".

Remove-AzResourceGroup -Name "resourceGroup11"

Example 2: Remove a resource group without confirmation

This command removes the resource group named "resourceGroup11" without prompting for confirmation.

Remove-AzResourceGroup -Name "resourceGroup11" -Force

Example 3: Remove a resource group object from the pipeline

This command gets the resource group named "resourceGroup11" and passes it to Remove-AzResourceGroup using the pipeline operator.

Get-AzResourceGroup -Name "resourceGroup11" | Remove-AzResourceGroup

NOTES

Resource groups can contain resources from different Azure services. When you delete a resource group, all resources within it are deleted.

The deletion process can take time depending on the number and types of resources in the group. You can monitor the deletion status.

RELATED LINKS