Gallery › General › Azure Community Policy
Use match condition on tag value.
Doesn't convert yet Policy Audit Deny Disabled Mode All Version 1.0.0
Enforce a text pattern on tag value.
ConvertTo-Bylaw can't convert this policy yet:
- BYL6004 The converted file doesn't compile to the same definition (DifferentAsWritten), so it wasn't kept. properties.policyRule.if: The conditions differ as written: with [tags.date match "##-???-####"] true, [tags['date'] match "##-???-####"] false, the second matches and the first doesn't. Leaf conditions are treated as independent, so they may still be equivalent.
Azure Policy JSONazurepolicy.json · 39 lines
{
"name": "c16955f5-8268-4875-9354-c8d81247ffe4",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Use match condition on tag value.",
"description": "Enforce a text pattern on tag value.",
"metadata": {
"version": "1.0.0",
"category": "General"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"not": {
"field": "tags.date",
"match": "##-???-####"
}
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Source: policyDefinitions/General/use-match-condition-on-tag-value/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw