SoniaCuff this is great, thanks for the info. I have tried to use it to create a slightly more complex policy but I don't think I have it right. I want my policy to perform an audit action if multiple options are met.
The policy will audit for storage accounts which should have infrastructure encryption enabled if the tag is present and the value is set to true. I have put the code below, could you provide some guidance on why this doesn't work?
{
"mode": "Indexed",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/encryption.requireInfrastructureEncryption",
"notEquals": "true"
},
{
"field": "[concat('tags[', parameters('tagName'), ']')]",
"equals": "[parameters('tagValue')]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"parameters": {
"tagName": {
"type": "String",
"metadata": {
"displayName": "PII",
"description": "PII"
}
},
"tagValue": {
"type": "String",
"metadata": {
"displayName": "True",
"description": "True"
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the audit policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
}
}