< Back

Add-AzureRmTagToResource

Sat Jan 11, 2020 10:34 am

NAME Add-AzureRmTagToResource



SYNOPSIS

Add a tag to an Azure Resource





SYNTAX

Add-AzureRmTagToResource -ResourceGroupName <String> [-TagName <String>] -TagValue <String> [-Name <String>]

[-WithoutTagOnly] [<CommonParameters>]



Add-AzureRmTagToResource -ResourceGroupName <String> [-TagName <String>] [-Name <String>] -ApplyParentTags

[-WithoutTagOnly] [<CommonParameters>]





DESCRIPTION

Add a tag to an Azure Resource





PARAMETERS

-ResourceGroupName <String>

Name of the resource group that you want to work against



Required? true

Position? named

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-TagName <String>

Name of the tag that you want to apply to the resource



Default value is: "OrganizationName"



Required? false

Position? named

Default value OrganizationName

Accept pipeline input? false

Accept wildcard characters? false



-TagValue <String>

Value of the tag that you want to apply to the resource



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <String>

Name of the resource that you want to work against



Support for wildcards like "DEV*"



Required? false

Position? named

Default value *

Accept pipeline input? false

Accept wildcard characters? false



-ApplyParentTags [<SwitchParameter>]

Switch to instruct the cmdlet to pull the current tag collection

from the resource group and use that when applying on the resource



Required? true

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WithoutTagOnly [<SwitchParameter>]

Switch to instruct the cmdlet to only apply the tag to resources

with any tag details specified.



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 (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Author: M??????tz Jensen (@splaxi)



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Add-AzureRmTagToResource -ResourceGroupName "DEV" -TagValue "CustomerA"



This will add tag "OrganizationName" with the value "CustomerA" to all

resource found in the ResourceGroup named "DEV".









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-AzureRmSubscriptionExt -SubscriptionName "*DEV*" | Get-AzureRmResourceGroupExt -ResourceGroupName

"*DEV*" |



Add-AzureRmTagToResource -TagValue "CustomerA"



This will select the subscription named DEV and find the resource group name DEV,

and add the tag "OrganizationName" with the value "CustomerA" to all resources

in the resource group.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-AzureRmSubscriptionExt -SubscriptionName "*DEV*" | Get-AzureRmResourceGroupExt -ResourceGroupName

"*DEV*" |



Add-AzureRmTagToResource -ApplyParentTags



This will select the subscription that matches the search *DEV*,

find the resource group that matches *DEV* in that subscription

and the tag collection from that ResourceGroup to all resources.











RELATED LINKS