Hi, I'm trying to create a policy in order to deny the creation of secrets without expiration date set in Key Vault.
What I have is the following, but it's not working. It lets me create secrets no matter what. I don't know why is not applying. Could you help me please?
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.KeyVault/vaults/secrets"
},
{
"field": "Microsoft.KeyVault/vaults/secrets/attributes.exp",
"exists": false
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny creation of secrets withouth expiration date."
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny"
}
}
}
Thanks so much in advanced,
María
