I am trying to create a azure policy that blocks resources from having tag that start’s with "ABC".
POLICY
"parameter" :{
"tagname":{
"type":"string",
"defaultValue":"ABC"
}
},
"policyRule" :{
"if" : {
"allOf" : [
{
"field":"type",
"equals":"Microsoft.Storage/storageAccounts"
},
{
"field":"[concat('tags[', parameter('tagname'), '*', ']')]",
"exists":true
}
]
},
"then":{
"effect":"deny"
}
}
Can we use regular expressions like "ABC*" to get tags that starts with ABC in tagname
2
Answers
try this.
Here is the updated policy to block the Tag name start with ABC.
Policy is denying Resource Group creation if I enter the
Tag
name "ABC"