Remove-​Azure​Rm​Resource​Group

Removes a resource group.

Syntax

Remove-AzureRmResourceGroup
      [-Id] <String>
      [-ApiVersion <String>]
      [-Force]
      [-Pre]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]
Remove-AzureRmResourceGroup
      [-Name] <String>
      [-ApiVersion <String>]
      [-Force]
      [-Pre]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]

Description

The Remove-AzureRmResourceGroup 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-AzureRmResource cmdlet.

Examples

Example 1: Remove a resource group

PS C:\>Remove-AzureRmResourceGroup -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

PS C:\>Get-AzureRmResourceGroup -Name "ContosoRG01" | Remove-AzureRmResourceGroup -Verbose -Force

This command uses the Get-AzureRmResourceGroup cmdlet to get the resource group ContosoRG01, and then passes it to Remove-AzureRmResourceGroup by using the pipeline operator. The Verbose common parameter gets status information about the operation, and the Force parameter suppresses the confirmation prompt.

Example 3: Remove all resource groups

PS C:\>Get-AzureRmResourceGroup | Remove-AzureRmResourceGroup

This command uses the Get-AzureRmResourceGroup cmdlet to get all resource groups, and then passes them to Remove-AzureRmResourceGroup by using the pipeline operator.

Required Parameters

-Id

Specifies the ID of resource group to remove. Wildcard characters are not permitted.

Type:String
Aliases:ResourceGroupId, ResourceId
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the names of resource groups to remove. Wildcard characters are not permitted.

Type:String
Aliases:ResourceGroupName
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-ApiVersion

Specifies the API version that is supported by the resource Provider. You can specify a different version than the default version.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Pre

Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

None