last sync: 2020-Jul-15 14:17:33 UTC

Azure Policy

Require a tag and its value on resource groups

Policy DisplayName Require a tag and its value on resource groups
Policy Id 8ce3da23-7156-49e4-b145-24f95f9dcb46
Policy Category Tags
Policy Description Enforces a required tag and its value on resource groups.
Policy Mode All
Policy Type BuiltIn
Policy in Preview FALSE
Policy Deprecated FALSE
Policy Effect Fixed: deny
Roles used none
Policy Changes
Date/Time (UTC ymd) (i) Change Change detail
2020-03-10 16:29:49 change: DisplayName previous DisplayName: Require tag and its value on resource groups
Used in Policy Initiative(s) none
Policy Rule
{
  "properties": {
    "displayName": "Require a tag and its value on resource groups",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Enforces a required tag and its value on resource groups.",
    "metadata": {
      "version": "1.0.0",
      "category": "Tags"
    },
    "parameters": {
      "tagName": {
        "type": "String",
        "metadata": {
          "displayName": "Tag Name",
          "description": "Name of the tag, such as 'environment'"
        }
      },
      "tagValue": {
        "type": "String",
        "metadata": {
          "displayName": "Tag Value",
          "description": "Value of the tag, such as 'production'"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Resources/subscriptions/resourceGroups"
          },
          {
          "field": "[concat('tags[', parameters('tagName'), ']')]",
          "notEquals": "[parameters('tagValue')]"
          }
        ]
      },
      "then": {
        "effect": "deny"
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/8ce3da23-7156-49e4-b145-24f95f9dcb46",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "8ce3da23-7156-49e4-b145-24f95f9dcb46"
}