Skip to content
Menu
Tech Automation Blog
  • About Author
  • Contact
Tech Automation Blog

Add Tags to Azure Subscription

Posted on April 24, 2020January 20, 2022

Tags help to logically organize Azure resources in the environment. It is one of the fundamental principal of good cloud Governance. Each tag consist of a Key and a Value pair. For example, a Key could be “Environment” and corresponding Value is “Development” , or it could be “Application” as Key and “Payroll” as Value.

Microsoft allows you to apply tags on most of azure resource types and Resource Groups. A feature to apply tags on Subscription was a long pending request to Microsoft and the good news is, it is now available! Thank you Microsoft!

Refer following link to know more : https://feedback.azure.com/forums/281804-azure-resource-manager/suggestions/13300434-add-tag-to-subscription?tracking_code=6ed3a1ed74ead6602f12fa3e8b245bb2

As this feature is now available, I will provide you a quick script snippet on how to set that using Powershell. Before starting, you need to install/import latest Az.Resources module on your system. Check current version of your Az.Resources module :

Get-Module -ListAvailable Az.Resources

Now update/install this module with following command :

Update-Module Az.Resources
#Or use Install module command if it is not already installed
Install-Module Az.Resources

Login to your Azure tenant and get Subscription Id on which new tags will be applied.

$subscription = Get-AzSubscription -SubscriptionName <My Subscription Name>
$subscriptionId = $subscription.Id

Now, define a Hash table of tag key/value pairs to be applied on the Subscription

$tags = @{"Environment"="Development"; "Application"="Payroll"}

Finally, apply tags to the subscription with following powershell command :

New-AzTag -ResourceId "/subscriptions/$subscriptionId" -Tag $tags

If you want to update or add tags to existing tags to the subscription, use following command :

Update-AzTag -ResourceId "/subscriptions/$subscriptionId" -Tag $tags -Operation Merge

That’s it! Now you should be able to apply tags to your Subscription.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
June 2025
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« May    

Recent Posts

  • Monitor and alert Azure Service Health issues May 5, 2020
  • AWS IAM User access review May 3, 2020
  • Integrate Azure Security Center with Event Hub April 28, 2020
  • Add Tags to Azure Subscription April 24, 2020
  • Automate Azure billing report in Excel March 6, 2020

Categories

©2025 Tech Automation Blog | Powered by SuperbThemes