< Back

Remove-AzureRmResourceGroup

Tue Jan 29, 2019 10:06 pm

NAME Remove-AzureRmResourceGroup



SYNOPSIS

Removes a resource group.





SYNTAX

Remove-AzureRmResourceGroup [-Id] <String> [-ApiVersion <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-Force] [-Pre] [-Confirm]

[-WhatIf] [<CommonParameters>]



Remove-AzureRmResourceGroup [-Name] <String> [-ApiVersion <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-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.





PARAMETERS

-ApiVersion <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Forces the command to run without asking for user confirmation.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Id <String>

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



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>

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



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Pre [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None







OUTPUTS

None







NOTES









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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ourcegroup

Get-AzureRmResourceGroup

New-AzureRmResourceGroup

Set-AzureRmResourceGroup