mirror of
https://dev.azure.com/effectory/Survey%20Software/_git/Cloud%20Engineering
synced 2026-02-27 18:52:18 +01:00
Add "Resources of type X should have tag" policy
This commit is contained in:
37
Policies/must-have-tag.json
Normal file
37
Policies/must-have-tag.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"properties": {
|
||||
"displayName": "Must have tag",
|
||||
"policyType": "Custom",
|
||||
"mode": "All",
|
||||
"metadata": {
|
||||
"category": "Effectory Custom Policies"
|
||||
},
|
||||
"parameters": {
|
||||
"tagName": {
|
||||
"type": "String",
|
||||
"metadata": {
|
||||
"displayName": "tagName",
|
||||
"description": "Tag name"
|
||||
}
|
||||
},
|
||||
"allowedTags": {
|
||||
"type": "Array",
|
||||
"metadata": {
|
||||
"displayName": "Allowed tags",
|
||||
"description": "The list of allowed tags for resources."
|
||||
}
|
||||
}
|
||||
},
|
||||
"policyRule": {
|
||||
"if": {
|
||||
"not": {
|
||||
"field": "[concat('tags[', parameters('tagName'), ']')]",
|
||||
"in": "[parameters('allowedTags')]"
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"effect": "audit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user