Forum Discussion
Racheal2k
Oct 11, 2022Copper Contributor
Update-AzScheduledQueryRule throws exception
HI,
I need to disable an alert using Update-AzScheduledQueryRule but it throws AggregateException as below.
It works with below alerts which has aggregation
customMetrics | where timestamp > ago(15m) and name == 'Heap Memory Used (MB)' and and valueMax >= 35500 | summarize AggregatedValue = max(valueMax) by bin(timestamp, 1h)
it doesn't work with the below alert
availabilityResults
| where name contains 'health'
| where success == 0 and message != "Passed"
--------------------------------------------------------------------------------------------------------------
Update-AzScheduledQueryRule : Exception type: Exception, Message: System.Exception: Error in updating Log Alert Rule ---> System.AggregateException: One or more errors occurred. ---> Microsoft.Azure.Management.Monit
or.Models.ErrorContractException: Operation returned an invalid status code 'BadRequest'
at Microsoft.Azure.Management.Monitor.ScheduledQueryRulesOperations.<UpdateWithHttpMessagesAsync>d__7.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.Azure.Commands.Insights.ScheduledQueryRules.UpdateScheduledQueryRuleCommand.ProcessRecordInternal()
--- End of inner exception stack trace ---
at Microsoft.Azure.Commands.Insights.ScheduledQueryRules.UpdateScheduledQueryRuleCommand.ProcessRecordInternal()
at Microsoft.Azure.Commands.Insights.MonitorCmdletBase.ExecuteCmdlet(), Code: Null, Status code:Null, Reason phrase: Null
At line:1 char:5
Is there a way to disable alerts without modifying the query.
Thanks.
- I'm using Azure Cli to enable / disable alerts
- Racheal2kCopper Contributor
CliveWatson , could you help here ?
- Racheal2kCopper ContributorI'm using Azure Cli to enable / disable alerts
- Racheal2kCopper ContributorAny suggestions on this ?