How to exclude the untaggable resources from the enforcement tag policy

Sun, Scott 20 Reputation points
2024-02-20T03:06:24.72+00:00

We have current tag policy to enforce certain tags on the management group level. however, we would like to create exemption policy to exclude any untaggable Azure resource, eg Solution, Azure DevOps Organization, etc. How can we add it in the code?

"policyRule": {
  "if": {
    "anyOf": [
      {
        "field": "tags.ApplicationName",
        "exists": false
      },
      {
        "field": "tags.ApplicationID",
        "exists": false
      },
      {
        "field": "tags.Branch",
        "exists": false
      },
      {
        "field": "tags.Environment",
        "exists": false
      },
      {
        "field": "tags.CostCentre",
        "exists": false
      },
      {
        "field": "tags.CostCentreName",
        "exists": false
      }
    ]
  },
  "then": {
    "effect": "audit"
  }
}
```  },
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
799 questions
0 comments No comments
{count} votes

Accepted answer
  1. SwathiDhanwada-MSFT 17,726 Reputation points
    2024-02-20T06:41:20.34+00:00

    @Sun, Scott Within the policy definition, you can list out the resources that can be ignored or considered using below snippet.

    { 
    	"field": "type", 
        "in": ["<< provide list of resource types >>]
         
    }
    

    Kindly try it out and let me know if you face any issues.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful