locked
Script to disable all metric alerts at once during scheduled maintenance RRS feed

  • Question

  • Hi Team,

    I am trying to disable all alerts at once during scheduled maintenance, is that possible? All alerts created from log analytics,

    Also i have tried PS script mentioned on below link but the problem is its for classic alert not metric alerts.

    function Disable-AllRules { 
        param([string]$RG) 
        foreach ($rule in $alertRules) { 
            Add-AzureRmMetricAlertRule ` 
                -ResourceGroupName $RG ` 
                -TargetResourceId $rule.Condition.DataSource.ResourceUri ` 
                -Location $rule.Location ` 
                -Name $rule.AlertRuleResourceName ` 
                -Description $rule.Description ` 
                -MetricName $rule.Condition.DataSource.MetricName ` 
                -Operator $rule.Condition.OperatorProperty ` 
                -Threshold $rule.Condition.Threshold ` 
                -WindowSize $rule.Condition.WindowSize ` 
                -TimeAggregationOperator $rule.Condition.TimeAggregation ` 
                -DisableRule; 


    is there any way to disable all metric alerts at once, please help he on this.

    Thanks

    Vasudeva Reddy 

    • Moved by Bill_Stewart Wednesday, September 4, 2019 9:06 PM Unanswerable drive-by question
    Thursday, April 11, 2019 6:59 AM