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

Azure Policy

Require a tag and its value on resources

Policy DisplayName Require a tag and its value on resources
Policy Id 1e30110a-5ceb-460c-a204-c1c3969c6d62
Policy Category Tags
Policy Description Enforces a required tag and its value. Does not apply to resource groups.
Policy Mode Indexed
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
Used in Policy Initiative(s) none
Policy Rule
{
  "properties": {
    "displayName": "Require a tag and its value on resources",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Enforces a required tag and its value. Does not apply to resource groups.",
    "metadata": {
      "version": "1.0.1",
      "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": {
        "not": {
        "field": "[concat('tags[', parameters('tagName'), ']')]",
        "equals": "[parameters('tagValue')]"
        }
      },
      "then": {
        "effect": "deny"
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "1e30110a-5ceb-460c-a204-c1c3969c6d62"
}