• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

UnixArena

  • Home
  • kubernetes
  • DevOps
    • Terraform
    • Jenkins
    • Docker
    • Openshift
      • OKD
    • Ansible engine
    • Ansible Tower
      • AWX
    • Puppet
  • Cloud
    • Azure
    • AWS
    • Openstack
    • Docker
  • VMware
    • vCloud Director
    • VMware-Guests
    • Vcenter Appliance 5.5
    • vC OPS
    • VMware SDDC
    • VMware vSphere 5.x
      • vSphere Network
      • vSphere DS
      • vShield Suite
    • VMware vSphere 6.0
    • VSAN
    • VMware Free Tools
  • Backup
    • Vembu BDR
    • Veeam
    • Nakivo
    • Azure Backup
    • Altaro VMBackup
    • Spinbackup
  • Tutorials
    • Openstack Tutorial
    • Openstack Beginner’s Guide
    • VXVM-Training
    • ZFS-Tutorials
    • NetApp cDot
    • LVM
    • Cisco UCS
    • LDOM
    • Oracle VM for x86
  • Linux
    • How to Articles
    • Q&A
    • Networking
    • RHEL7
  • DevOps Instructor-led Training
  • Contact

Azure tag automation using an Initiative definition

December 13, 2020 By Cloud_Devops Leave a Comment

Azure tag automation using an Initiative definition. In Cloud, Tags are metadata values that contain keys and values to help users organize and bring governance to cloud resources. Tagging is essential because it helps to efficiently optimize costs across cloud providers by assigning useful information to any resource within your cloud infrastructure. It also helps to group the resources based on application or business. In Azure, each resource, resource group, and subscription can have a maximum of 50 tag name/value pairs. The tag name is limited to 512 characters, and the tag value is limited to 256 characters. For storage accounts, the tag name is limited to 128 characters, and the tag value is limited to 256 characters.

Our Approach :

For each resource deployment, we can pass the standard tags but at some point, it will become painful since we might need to pass the value for more than 10 tags for each resource deployment. How to overcome this pain area? Here are a few tricks that can be followed in your subscriptions.

  1. Create a resource group with mandatory tags
  2. Apply subscription level policy to inherit missing tags from the resource group – If you have only one or two tags.
  3. If you have multiple tags, use the policy initiative

Option -1 : Definiation tag inheritance:

If you need to manage one or two tags, use azure policy to update tags automatically by inheriting them from the resource group.

  1. Login to Azure portal with contributor access.

2. Navigate to Policy (Search policy in the top search bar)

3. Navigate to definition and in the search bar, just type “inherit“. Select the highlighted policy to automatically inherit the tag from resource group.

Policy - Inherit a tag from resource group if missing
Policy – Inherit a tag from resource group if missing

4. Update the assignment name and select the scope as your subscription.

Create policy - Inherit a tag from RG
Create policy – Inherit a tag from RG

5. Update the tag which needs to be inherited from resource group.

Enter tag which needs to be inherited from RG
Enter tag which needs to be inherited from RG

6. Would you like to remediate the existing resources ? So that the defined tag will inherited from resource group and applied to all the resources.

Tag Compliance - Remediation task
Tag Compliance – Remediation task

7. Review and create the policy definition.

Policy applied for selected scope
Policy applied for selected scope

Option – 2: Policy Initiative definition

If you are using more than one tag, use policy initiative. Policy initiative is a collection of Azure policy definitions that are grouped together towards a specific goal or purpose in mind. Azure initiatives simplify the management of your policies by grouping a set of policies together as one single item. 

Azure Tag Automation using an Initiative definition
azure-policy-initiative

How to create an initiative definition?

Azure tag automation using policy initiative definition.

1.Login to Azure portal and navigate to policy.

2. Click on definition and on the top click “initiative definition“. Enter the new initiative definition name

New initiative definition name
New initiative definition name

3. Add the policy definition to initiative definition.

Add policy definition to initiative definition
Add policy definition to initiative definition

4. Repeat step number 3 based on your requirement. In my case, I want to inherit 4 tags from the resource group. So I had repeated them 4 times.

Repeat policy definition as required
Repeat policy definition as required

5. Add the tag values which needs to be inherited from resource group.

Azure Tag Automation using an Initiative definition
Add the tag values

6. Review and create initiative definition.

Review and Create initiative definition
Review and Create initiative definition

7. We could see the newly created initiative definition in policy.

Policy Definitions
Policy Definitions

Assign the initiative to the subscription:

  1. Click the newly created initiative definition.
Azure Tag Automation using an Initiative definition
Assign the tag update initiative to subscription

2. Select the subscription and click review & create. Policy will be applied with immediate effect.

Select initiative scope - Azure Tags
Select initiative scope – Azure Tags

Test the initiative definition:

  1. Here is the resource group which created with standard tags.
Test Tag automation - Sample resource group
Test Tag automation – Sample resource group

2. Let’s create a new resource without passing the tags.

Create storage account without tags
Create storage account without tags

3. Here is the new storage account and we could see that tags are automatically inherited from the resource group. This would really save a lot of time and bring some consistency around the tags for sure.

Test Tag automation using storage account
Test Tag automation using storage account

Hope this article is informative to you.

Filed Under: Automation, Azure, Azure, Cloud, Cloud Automation, Microsoft Tagged With: Azure, azure initiative definition, azure policy, Azure tag automation, inherit tags from resource group - Azure, policy definitions

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow UnixArena

  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · UnixArena ·

Go to mobile version