Skip to content

NKCODE TECH GEEK ZONE

  • RSS - Posts
Menu
  • Home
  • Cloud
    • Azure
    • Alibaba
    • AWS
  • Hardware
  • Linux
  • Network
  • Security
  • Windows Client / Servers
    • SQL
    • Windows Client OS
      • Windows 10
    • Windows Servers
      • Windows 2008R2
      • Windows Server 2012R2
      • Windows Server 2016
      • Windows Server 2019
  • VMWARE
  • Free Tools
  • About Me
    • Disclaimer
Menu

AZURE POLICY MANY TAGS ON RESOURCE GROUPS

Posted on May 17, 2019

Azure Policy can be used to enforce rules and effects on resources in Azure subscriptions. It is a part of the Azure Governance and management toolbox native to Azure.

In this blog post, I want to dig into Requiring Tags on Resource Groups via Azure Policy. There is a sample policy ARM Template to accomplish this here:

https://docs.microsoft.com/en-us/azure/governance/policy/samples/enforce-tag-on-resource-groups . What is not clear with the this policy template is how to add an enforce additional tags within the single ARM Template. This is important as you don’t want to have multiple templates to enforce multiple tags.

Well its actually pretty straight forward. You need to add the additional tags as Rules and Parameters. Here is the full example Policy ARM Template here:

{}{
“mode”: “all”,
“policyRule”: {
“if”: {
“allOf”: [
{
“field”: “type”,
“equals”: “Microsoft.Resources/subscriptions/resourceGroups”
},
{
“not”: {
“field”: “[concat(‘tags[‘,parameters(‘Project’), ‘]’)]”,
“exists”: “true”
}
},
{
“not”: {
“field”: “[concat(‘tags[‘,parameters(‘Functional Area’), ‘]’)]”,
“exists”: “true”
}
},
{
“not”: {
“field”: “[concat(‘tags[‘,parameters(‘Environment’), ‘]’)]”,
“exists”: “true”
}
},
{
“not”: {
“field”: “[concat(‘tags[‘,parameters(‘AppOwner’), ‘]’)]”,
“exists”: “true”
}
}
]
},
“then”: {
“effect”: “deny”
}
},
“parameters”: {
“BillTo”: {
“type”: “String”,
“metadata”: {
“description”: “Provides a project to attribute the bill for the resources too. Tag value: Project Cost Center. Example: nkcode@nkcode.xyz”
}
},
“Functional Area”: {
“type”: “String”,
“metadata”: {
“description”: “Provides information on department or team is responsible for administering/supporting the application. Tag value: Team name/email. Example: web”
}
},
“Environment”: {
“type”: “String”,
“metadata”: {
“description”: “Provides information on what the resource group is used for (useful for maintenance, policy enforcement, chargeback, etc.) Tag value: Dev, QA, Stage, Test, Prod. Example: Prod”
}
},
“AppOwner”: {
“type”: “String”,
“metadata”: {
“description”: “The Business app owner to contact. Tag value: Business App owners’ email. Example: nkadmin@nkcode.xyz”
}
}
}
}

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
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

Welcome to Teck Geek Zone

Alibaba & Azure Cloud with a free trial worth $200-1200 USD Click below Cloud Providers

  • Securing Your Cloud Environment with Alibaba Cloud Firewall
  • 🚢 Sailing into the Data Age: How Cloud and IoT are Revolutionizing the Marine Industry
  • What is Azure Grafana? A Comprehensive Guide to Monitoring and Visualization
  • 🔐 How to Enable Virtualization-Based Security (VBS) for Windows Workloads in VMware Cloud Foundation and vSphere
  • Microsoft’s Azure SRE Agent: AI-Powered Reliability Engineering

Categories

  • Cloud (186)
    • Alibaba (39)
    • AWS (39)
    • Azure (114)
  • Free Tools (5)
  • Hardware (17)
  • Linux (13)
  • Network (28)
  • Security (21)
  • VMWARE (54)
  • Windows OS (44)
    • Windows 10 (7)
  • Windows Servers (69)
    • SQL (3)
    • Windows 2008R2 (7)
    • Windows Server 2012R2 (15)
    • Windows Server 2016 (20)
    • Windows Server 2019 (10)

Subscribe to our newsletter

©2025 NKCODE TECH GEEK ZONE | Design: Newspaperly WordPress Theme
%d