Update-AzScheduledQueryRule throws exception

Racheal 6 Reputation points
2022-10-14T08:11:48.93+00:00

Hi,

I need to disable an alert using Update-AzScheduledQueryRule but it throws AggregateException as below for the alert with query

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.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,462 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 18,881 Reputation points
    2022-10-27T07:22:13.547+00:00

    @Racheal Welcome to Microsoft Q & A Community Forum. Kindly note that the query of a metric measurement alert rule must include an AggregatedValue column of a numeric type.

    Log alerts that do not meet this condition are failing to be disabled with powershell cmdlet Update-AzScheduledQueryRule. Product Group team has a note of this to provide the error message better.

    0 comments No comments

  2. Saurabh Bhargava 1 Reputation point Microsoft Employee
    2022-12-28T09:35:21.8+00:00

    In case we dont have these conditions than which command can we use?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.