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:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Reddit (Opens in new window) Reddit
  • 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

  • How to Configure Multi-Pool Point-to-Site (P2S) VPN Using Azure Virtual WAN (vWAN)
  • 🔐 IoT Security with AWS IoT: Building Secure Connected Systems at Scale
  • Azure Service Endpoint vs Private Endpoint: What’s the Difference and When to Use Each?
  • Amazon Inspector Code Security: Shifting Left with Automated Vulnerability Detection
  • Azure Introduces Network Security Hub: A Smarter Way to Secure Your Cloud Network

Categories

  • Cloud (200)
    • Alibaba (39)
    • AWS (45)
    • Azure (122)
  • Free Tools (5)
  • Hardware (17)
  • Linux (13)
  • Network (28)
  • Security (21)
  • VMWARE (58)
  • 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

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