{
   "properties": {
      "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"
         }
      }
   },
   "id": "/providers/Microsoft.Authorization/policyDefinitions/96670d01-0a4d-4649-9c89-2d3abc0a5025",
   "name": "96670d01-0a4d-4649-9c89-2d3abc0a5025"
}