Remove-​Azure​Rm​Tag

Deletes predefined Azure tags or values.

Syntax

Remove-AzureRmTag
      [-Name] <String>
      [[-Value] <String[]>]
      [-PassThru]
      [-Confirm]
      [-WhatIf]
      [<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. If the subscription includes any predefined tags, you cannot apply undefined tags or values to any resource or resource group in the 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.

Required Parameters

-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 (ByPropertyName)
Accept wildcard characters:False

Optional 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
-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 (ByPropertyName)
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 (ByPropertyName)
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 or Microsoft.Azure.Commands.Tags.Model.PSTag