I'm trying to create an Azure Policy which prevents creation of Application Insights resources when:
- daily volume cap is not set,
- or when the cap is greater than 1 (GB).
Here is the policy rule definition:
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "microsoft.insights/components/pricingPlans"
},
{
"anyOf": [
{
"field": "microsoft.insights/components/pricingPlans/cap",
"exists": "false"
},
{
"field": "microsoft.insights/components/pricingPlans/cap",
"greater": 1
}
]
}
]
},
"then": {
"effect": "deny"
}
}
}
Unfortunately the definition doesn't work = has no effect :(
I've also tried with different field like "microsoft.insights/components/currentbillingfeatures/dataVolumeCap/cap" but it doesn't help.
What I'm doing wrong? Is it possible to define such kind of policy?