0
votes

I am trying to disable Azure alert rule with target resource LogAnalytics workspace using below powershell command,

Update-AzScheduledQueryRule -ResourceGroupName $ResourceGroupName -Name $AlertRuleName -Enabled $false

But getting below error:

Exception type: Exception, Message: System.Exception: Error in updating Log Alert Rule ---> System.AggregateException: One or more errors occurred. ---> Microsoft.Azure.Management.Monitor.Models.ErrorResponseException: Operation returned an invalid status code 'BadGateway'
   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) 
1

1 Answers

0
votes

The bad request error is too board, you could use Fiddler to catch the detailed error message.I test in my site and it works well. For more details, please refer to the link.

Update-AzScheduledQueryRule -ResourceGroupName "MyResourceGroup" -Name "LogAlertRule1" -Enabled $false