Skip to content

Instantly share code, notes, and snippets.

@azMantas
Created May 4, 2021 07:02
Show Gist options
  • Save azMantas/4fc2d334bd124561e282c952c99b88ca to your computer and use it in GitHub Desktop.
Save azMantas/4fc2d334bd124561e282c952c99b88ca to your computer and use it in GitHub Desktop.
Manage tags in Azure: Policy initiative
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"Name": {
"type": "string",
"defaultValue": "policy-name"
},
"DisplayName": {
"type": "string",
"defaultValue": "displayName"
},
"Category": {
"type": "string",
"defaultValue": "Tags"
}
},
"functions": [],
"variables": {},
"resources": [
{
"type": "Microsoft.Authorization/policySetDefinitions",
"apiVersion": "2019-09-01",
"name": "[parameters('Name')]",
"location": "[deployment().location]",
"properties": {
"displayName": "[parameters('DisplayName')]",
"metadata": {
"category": "[parameters('Category')]"
},
"policyDefinitions": [
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/61a4d60b-7326-440e-8051-9f94394d4dd1",
"parameters":{
"tagName": {
"value": "environment"
},
"tagValue": {
"value": "Playground"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/b27a0cbd-a167-4dfa-ae64-4337be671140",
"parameters": {
"tagName": {
"value": "organizational-unit"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/b27a0cbd-a167-4dfa-ae64-4337be671140",
"parameters": {
"tagName": {
"value": "system-name"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/b27a0cbd-a167-4dfa-ae64-4337be671140",
"parameters": {
"tagName": {
"value": "PSP-element"
}
}
}
]
}
}
],
"outputs": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment