last sync: 2021-Sep-24 16:09:49 UTC

Azure Policy definition

Require a tag on resource groups

Name Require a tag on resource groups
Azure Portal
Id 96670d01-0a4d-4649-9c89-2d3abc0a5025
Version 1.0.0
details on versioning
Category Tags
Microsoft docs
Description Enforces existence of a tag on resource groups.
Mode All
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Fixed: deny
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2020-03-10 16:29:49 change Previous DisplayName: Require specified tag on resource groups
Used in Initiatives none
JSON
{
  "displayName": "Require a tag on resource groups",
  "policyType": "BuiltIn",
  "mode": "All",
  "description": "Enforces existence of a tag 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'"
      }
    }
  },
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Resources/subscriptions/resourceGroups"
        },
        {
          "field": "[concat('tags[', parameters('tagName'), ']')]",
          "exists": "false"
        }
      ]
    },
    "then": {
      "effect": "deny"
    }
  }
}