Skip to content

Instantly share code, notes, and snippets.

@andrewmatveychuk
Created December 19, 2022 15:31
Show Gist options
  • Save andrewmatveychuk/02fc8cedf53e98730b02da8e98853f7b to your computer and use it in GitHub Desktop.
Save andrewmatveychuk/02fc8cedf53e98730b02da8e98853f7b to your computer and use it in GitHub Desktop.
Defining Azure Policy effect as a parameter
//...
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
//...
// Other policy properties
//...
"policyRule": {
"if": {
// Rule conditions
},
"then": {
"effect": "[[parameters('effect')]"
}
}
//...
@OlegMudryak
Copy link

Hello!
I have used this approach and override effect during assignment a policy (from default audit to deny) but see weirdness behavior - I see in assignment "Audit" (that should be Deny) and in fact it's Deny.
Have you faced with that? is it my misunderstanding or Azure's bug?

@andrewmatveychuk
Copy link
Author

Hi @OlegMudryak!

Try refreshing the portal page or do a complete logoff/logon. It might be a caching issue in your browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment