How can we improve Azure Governance?

Parameters Concatenation

I have a naming policy for resource type and i am naming it at a category level. I.e
If Resource is of type CDN or Network then name should be CLIENT1-DEV-INT-<nameofresource>
else If the Resource is of type AppFunction, AppService then name should be CLIENT1-DEV-WEB-<nameofresource>
etc.

So this Policy will be massive and having multiple clients I need to introduce a parameter to cover for first bit to be same i.e instead of hard coding CLIENT1-DEV I use parameter and make policy general and use CONCATENATION in the LIKE portion of policy like below.

{
"policyRule": {
"if": {
"not": {
"allOf": [
{
"field": "name",
"like": "[parameters('ClientName')]-INT-*"
},
{
"anyOf": [
{
"field": "type",
"like": "Microsoft.Cdn*"
},
{
"field": "type",
"like": "Microsoft.Network*"
}
]
}
]
}
},
"then": {
"effect": "Deny"
}
},
"parameters": {
"ClientName": {
"type": "String",
"metadata": {
"description": "The Name of Client.",
"displayName": "Name Of Client"
}
}
}
}

3 votes
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)

We’ll send you updates on this idea

Omer Zubair shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
  • Omer Zubair commented  ·   ·  Flag as inappropriate

    Above JSON is small example. As you know there are about 19 categories. So the policy will grow.
    For every client this has to be diferent version, just because of the name diference.

Feedback and Knowledge Base