Skip to content

azure monitor query cannot use equals = or == in condition compare to threshold #17848

@cicorias

Description

@cicorias

Describe the bug

A valid query used for evaluation based upon Equal the symbol = is not valid, but error message says it should be. We also tried == to no avail

condition

count 'StorageBlobLogs  | where Uri has \'foo\' | take 1 ' == 0 resource id _ResourceID at least 1 violations out of 1 aggregated points

Command Name

az monitor scheduled-query create -g fffff -n fizbuzz --scopes /subscriptions/ffffresourcegroups/spz-hot-path-dv-01/providers/microsoft.operationalinsights/workspaces/zzzzz --condition  "count 'StorageBlobLogs  | where Uri has \'foo\' | take 1 ' == 0 resource id _ResourceID at least 1 violations out of 1 aggregated points" --description "Test rule"

Errors:

when using single =

BadRequest: Alert rule payload cannot be empty
➜  temp ./t.sh
line 1:59 mismatched input '==' expecting OPERATOR
usage error: --condition {avg,min,max,total,count} ["METRIC COLUMN" from]
                         "QUERY" {=,!=,>,>=,<,<=} THRESHOLD
                         [resource id RESOURCEID]
                         [where DIMENSION {includes,excludes} VALUE [or VALUE ...]
                         [and   DIMENSION {includes,excludes} VALUE [or VALUE ...] ...]]
                         [at least MinTimeToFail violations out of EvaluationPeriod aggregated points]

when using double equal ==

line 1:59 mismatched input '==' expecting OPERATOR
usage error: --condition {avg,min,max,total,count} ["METRIC COLUMN" from]
                         "QUERY" {=,!=,>,>=,<,<=} THRESHOLD
                         [resource id RESOURCEID]
                         [where DIMENSION {includes,excludes} VALUE [or VALUE ...]
                         [and   DIMENSION {includes,excludes} VALUE [or VALUE ...] ...]]
                         [at least MinTimeToFail violations out of EvaluationPeriod aggregated points]

To Reproduce:

run az cli command above

Expected Behavior

Alert created that provides a direct equals compare to the THRESHOLD

Environment Summary

Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-debian-buster-sid
Python 3.6.10
Installer: DEB

azure-cli 2.19.1 *

Extensions:
azure-devops 0.18.0
scheduled-query 0.2.2
stream-analytics 0.1.0

Additional Context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions