In this Azure PowerShell article, we will discuss the syntax and usage of the Update-AzTag PowerShell command with examples of how to use this command.
Update-AzTag
This command helps you update the tags on an Azure resource or subscription.
Syntax of Update-AzTag
Below is the syntax of the Update-AzTag PowerShell command.
Update-AzTag
[-ResourceId] <String>
[-Tag] <Hashtable>
[-Operation] <TagPatchOperation>Update-AzTag Examples
Example-1:
You can execute the below Azure PowerShell command to update the tags for the resource group using the below PowerShell cmdlet.
$mynewtags = @{"Apple"="ITS"; "Status01"="Startupnew"}
$resourceDetails = Get-AzResourceGroup -Name newresgroup
Update-AzTag -ResourceId $resourceDetails.ResourceId -Tag $mynewtags -Operation MergeAfter executing the above command, I got the expected output as below
Id : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/newresgroup/providers/Microsoft.Resources/tags/default
Name : default
Type : Microsoft.Resources/tags
Properties :
Name Value
========== ==========
Status01 Startupnew
Apple ITS You can check out the same output in the screenshot below

Example-2:
Similarly, you can update a new set of Azure tags for the subscription using the below PowerShell cmdlet.
$mynewtags = @{"Dept"="HR"}
$mysubscription = (Get-AzSubscription -SubscriptionName "Visual Studio Enterprise").Id
Update-AzTag -ResourceId "/subscriptions/$mysubscription" -Tag $mynewtags -Operation MergeAfter executing the PowerShell script, I got the expected output below.
Id : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/providers/Microsoft.Resources/tags/default
Name : default
Type : Microsoft.Resources/tags
Properties :
Name Value
==== =====
Dept HR You can check out the same output in the screenshot below.

You may also like following the articles below
Conclusion
This article discussed the syntax and usage of the Update-AzTag PowerShell command with examples of how to use this command. Thanks for reading this article !!!

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
