skip to Main Content

{
"properties": { —-> the very first statement errors out and cannot save JSON.

trying to deploy following JSON –

{
"properties": {
    "displayName": "Enforce Resource Group Tag Values",
    "policyType": "Custom",
  "mode": "All",
  "parameters": {
    "tagEnv": {
      "type": "String",
      "metadata": {
        "displayName": "Tag Environment",
        "description": "Name of the tag, such as 'environment'"

2

Answers


  1. I’m looking to have one tag with more than one possible value. I’ll use this policy to audit resources that are not in compliance.

    Here’s an updated policy to enforce tag with multiple possible values.

        {
          "mode": "All",
          "policyRule": {
            "if": {
              "not": {
                "field": "tags['environment']",
                "in": [
                  "production",
                  "development",
                  "testing"
                ]
              }
            },
            "then": {
              "effect": "audit"
            }
          },
          "parameters": {}
        }
    

    After applying the policy, it will audit existing resources if the tag does not have three values.

    enter image description here

    Login or Signup to reply.
  2. I’m looking to have one tag with more than one possible value. I’ll use this policy to audit resources that are not in compliance.

    Here’s an updated policy to enforce tag with multiple possible values.

        {
          "mode": "All",
          "policyRule": {
            "if": {
              "not": {
                "field": "tags['environment']",
                "in": [
                  "production",
                  "development",
                  "testing"
                ]
              }
            },
            "then": {
              "effect": "audit"
            }
          },
          "parameters": {}
        }
    

    After applying the policy, it will audit existing resources if the tag does not have three values.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search