Hi there

In this article I’m demonstrating how to use Azure Policy to enforce each Resource to be created within a specific resource with at least two TAGS: CostCenter and Environment.

Those TAGS are used for Cost Analysis at Azure Cost Center as well.
Download the policy used in this article.

Steps

1. Create the Azure Definition

Go to Azure portal \ Home \ “Search Resources, services and docs”
Search for Policy (then you can pin it on your home screen after)

On Azure policy screen select Definitions (left menu)





2. Assign the Azure Policy








3. Wait for the policy to get at its running state and check its compliance.
Home \ Policy \ Overview link

4. Test to add (create) a new azure resource within one of the Azure Resource Groups you defined (out of exclusions list).

TIP! – This will force each new azure resource that’s gonna be created at Demo1 Resource Group to have those two (02) TAGs. Otherwise, the validation step on creation will fail.

Use this policy to prevent that you have azure resources that are not being flagged and tracked properly at the cost center. Some users complained about costs surprises on their invoices and without policy enforcing TAGs properly we they simply lose the control on its monthly costs by Project, Environment, Cost Center or any other key used for Businesses.

Thanks,

Thiago Beier
TwitterLinkedInFacebookRSS