-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRequireDepartmentNameTagKeyWithSpecificValue.json
52 lines (52 loc) · 1.6 KB
/
RequireDepartmentNameTagKeyWithSpecificValue.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
"properties": {
"displayName": "Require a DepartmentName tag with Specific Department Name value",
"policyType": "Custom",
"mode": "All",
"description": "All resource groups must have a DepartmentName tag. The tag value should come from Finance's master list of departments.",
"parameters": {
"tagName": {
"type": "String",
"metadata": {
"displayName": "DepartmentName tag",
"description": "The DepartmentName tag key. Cannot be changed from DepartmentName."
},
"allowedValues": [
"DepartmentName"
],
"defaultValue": "DepartmentName"
},
"tagValue": {
"type": "Array",
"metadata": {
"displayName": "DepartmentName value",
"description": "The actual name of the department."
},
"allowedValues": [
"Comma delimited",
"List of department names",
"If you want to use a different source of truth",
"Change the departmentName value in tagName/displayName,allowedValues,etc. to whatever you want to name the tag key",
"And list the allowed tag values here"
]
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Resources/subscriptions/resourceGroups"
},
{
"field": "[concat('tags[', parameters('tagName'), ']')]",
"notIn": "[parameters('tagValue')]"
}
]
},
"then": {
"effect": "deny"
}
}
}
}