azure scheduled query rules ARM template
Type of issue
Typo
Reference command name
az deployment group create --name XXX --resource-group XXX --template-file XXX.json --parameters XXX.json --mode Incremental --output json
Overview
This issue is similar to https://github.com/Azure/azure-cli/issues/27138.
When using operator: Equals as specified in the Microsoft ARM documentation, the request fails with the error: Requested value 'Equals' was not found.
Feedback
Upon investigation, it appears that the correct value should be Equal, as confirmed by inspecting the actual network request on the portal. This discrepancy between the documentation and expected value leads to confusion and failed deployments.
{
"properties": {
"criteria": {
"allOf": [
{
"query": "AzureActivity | where TimeGenerated > ago(1h) | where OperationNameValue contains \"Microsoft.ContainerService/managedClusters/agentpools/write\" | where ActivityStatusValue == \"Started\"",
"timeAggregation": "Count",
"dimensions": [],
"resourceIdColumn": "",
"operator": "Equal",
"threshold": 1,
"failingPeriods": {
"numberOfEvaluationPeriods": 1,
"minFailingPeriodsToAlert": 1
}
}
]
}
}
}
After digging into the CLI extension where operator conversion is performed, it seems like the correct operator to be using is Equal instead of Equals.
https://github.com/Azure/azure-cli-extensions/blob/main/src/scheduled-query/azext_scheduled_query/grammar/scheduled_query/ScheduleQueryConditionValidator.py
I have attempted to change the operator to Equal inside the ARM template, and the deployment is able to go through successfully. I have yet to test both terraform and bicep template, but it might be worth updating the mentioned attribute in both documentation as well.
Page URL
https://learn.microsoft.com/en-us/azure/templates/microsoft.insights/2022-06-15/scheduledqueryrules?pivots=deployment-language-arm-template
Content source URL
No response
Author
No response
Document Id
No response
Thank you for opening this issue, we will look into it.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/deployments-owners.
Thanks for your patience — this was recently picked up as an outstanding open issue for the ARM Deployments team to review.
Thanks for doing the legwork here — your finding that the Insights RP accepts Equal (not the documented Equals), and the link back to #27138, made this easy to place.
This sits with Azure Monitor rather than the deployment engine. The operator value on scheduledQueryRules criteria is enforced by the Microsoft.Insights resource provider and described in its template reference, which is generated from the REST API spec. I confirmed locally that the template tooling doesn't constrain it — a Microsoft.Insights/scheduledQueryRules@2022-06-15 resource compiles to valid ARM whether operator is Equals or Equal:
operator: 'Equals' // bicep build → succeeds (no validation)
operator: 'Equal' // bicep build → succeeds
So the accepted token is decided server-side by the Insights RP at deployment time, and — as you found — it expects Equal. The mismatch with the docs is therefore a Monitor docs/spec issue, best fixed at the source (the REST API spec that generates the template-reference page).
I'm re-routing this to the Azure Monitor team to correct the documented value. In the meantime your workaround (Equal) is the right one. Could you confirm it's still working for you on your current deployments? Thanks again for the precise report.
Thanks for your patience — this was recently picked up as an outstanding open issue for the ARM Deployments team to review.
Thanks for doing the legwork here — your finding that the Insights RP accepts
Equal(not the documentedEquals), and the link back to #27138, made this easy to place.This sits with Azure Monitor rather than the deployment engine. The
operatorvalue onscheduledQueryRulescriteria is enforced by the Microsoft.Insights resource provider and described in its template reference, which is generated from the REST API spec. I confirmed locally that the template tooling doesn't constrain it — aMicrosoft.Insights/scheduledQueryRules@2022-06-15resource compiles to valid ARM whetheroperatorisEqualsorEqual:operator: 'Equals' // bicep build → succeeds (no validation) operator: 'Equal' // bicep build → succeeds So the accepted token is decided server-side by the Insights RP at deployment time, and — as you found — it expects
Equal. The mismatch with the docs is therefore a Monitor docs/spec issue, best fixed at the source (the REST API spec that generates the template-reference page).I'm re-routing this to the Azure Monitor team to correct the documented value. In the meantime your workaround (
Equal) is the right one. Could you confirm it's still working for you on your current deployments? Thanks again for the precise report.
Hello, thanks for reverting. Yes, the workaround is still working as intended.