Created
May 14, 2023 16:38
-
-
Save andrewmatveychuk/7bbcaa53d3c7fd60746e8759b2034367 to your computer and use it in GitHub Desktop.
Sample Azure Policy rule to match a specific date format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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