Remove-AzureRmTag

Deletes predefined Azure tags or values.

Important

Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024.

To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.

Syntax

Remove-AzureRmTag
      [-Name] <String>
      [[-Value] <String[]>]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzureRmTag cmdlet deletes predefined Azure tags and values from your subscription. To delete particular values from a predefined tag, use the Value parameter. By default, Remove-AzureRmTag deletes the specified tag and all of its values.You cannot delete a tag or value that is currently applied to a resource or resource group. Before using Remove-AzureRmTag, use the Tag parameter of the Set-AzureRMResourceGroup cmdlet to delete the tag or values from the resource or resource group. The Azure Tags module that Remove-AzureRmTag is part of can help you manage your predefined Azure tags. An Azure tag is a name-value pair that you can use to categorize your Azure resources and resource groups, such as by department or cost center, or to track notes or comments about the resources and groups. You can define and apply tags in a single step, but predefined tags let you establish standard, consistent, predictable names and values for the tags in your subscription.

Examples

Example 1: Delete a predefined tag

PS C:\>Remove-AzureRmTag -Name "Department"

This command deletes the predefined tag named Department and all of its resources. If the tag has been applied to any resources or resource groups, the command fails.

Example 2: Delete a value from a predefined tag

PS C:\>Remove-AzureRmTag -Name "Department" -Value "HumanResources" -PassThru
Name:   Department
Count:  14
Values: 

        Name        Count
        =========   =====

        Finance        2
        IT            12

This command deletes the HumanResources value from the predefined Department tag. It does not delete the tag. If the value has been applied to any resources or resource groups, the command fails.

Parameters

-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
-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Specifies the name of the tag to be deleted. By default, Remove-AzureRmTag removes the specified tag and all of its values. To delete selected values, but not delete the tag, use the Value parameter.

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-PassThru

Returns an object that represents the deleted tag or the resulting tag with deleted valued.

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

Deletes the specified values from the predefined tag, but does not delete the tag.

Type:String[]
Position:1
Default value:None
Accept pipeline input:True
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

String

String[]

SwitchParameter

Outputs

PSTag