Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewmatveychuk/7bbcaa53d3c7fd60746e8759b2034367 to your computer and use it in GitHub Desktop.
Save andrewmatveychuk/7bbcaa53d3c7fd60746e8759b2034367 to your computer and use it in GitHub Desktop.
Sample Azure Policy rule to match a specific date format
"parameters": {
"tagPattern": {
"type": "String",
"metadata": {
"displayName": "Tag pattern",
"description": "An expressions for \"notMatch\" condition"
}
}
// Other policy parameters...
},
"policyRule": {
"if": {
"field": "[[concat('tags[', parameters('tagName'), ']')]", // For example, 'createdDate' as the tag name
"notMatch": "[[parameters('tagPattern')]" // For example '####-##-##' to match '2023-03-16' as a date format
},
"then": {
// Some policy effect...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment