last sync: 2020-Oct-23 19:29:54 UTC

Azure Policy

Append a tag and its value to resources

Name Append a tag and its value to resources
Id 2a0e14a6-b0a6-4fab-991a-187a4f81c498
Version 1.0.1
details on versioning
Category Tags
Description Appends the specified tag and value when any resource which is missing this tag is created or updated. Does not modify the tags of resources created before this policy was applied until those resources are changed. Does not apply to resource groups. New 'modify' effect policies are available that support remediation of tags on existing resources (see https://aka.ms/modifydoc).
Mode Indexed
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Fixed: append
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2020-03-10 16:29:49 change Previous DisplayName: Append tag and its default value
Used in Initiatives none
Json
{
  "properties": {
    "displayName": "Append a tag and its value to resources",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Appends the specified tag and value when any resource which is missing this tag is created or updated. Does not modify the tags of resources created before this policy was applied until those resources are changed. Does not apply to resource groups. New 'modify' effect policies are available that support remediation of tags on existing resources (see https://aka.ms/modifydoc).",
    "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": {
      "field": "[concat('tags[', parameters('tagName'), ']')]",
        "exists": "false"
      },
      "then": {
        "effect": "append",
        "details": [
          {
          "field": "[concat('tags[', parameters('tagName'), ']')]",
          "value": "[parameters('tagValue')]"
          }
        ]
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "2a0e14a6-b0a6-4fab-991a-187a4f81c498"
}