Azure Alerts can be used to proactively notify you when important conditions are found in your monitoring data. After setting up either metric alerts or log alerts for your workloads, specifically IaaS workloads, there may be times when you need to disable those alerts during a maintenance window.
Depending on the size of your environment and the number of alerts you’ve created, it might be quite a chore to go through each one to disable/enable.
The following will demonstrate how to setup an Azure Automation Runbook to quickly set the status of our IaaS Alerts to either Enabled or Disabled via a webhook. The webhook will allow us to execute the Azure Automation Runbook from anywhere, like an on-premises workstation, to set the alert status. The runbook will also take advantage of Azure Resource Graph as a mechanism to search for alerts across all of the available subscriptions.
If you already have an alert(s) defined with the server name in the alert rule, skip this step.
(For Step 2, chose either 2a or 2b for creating/deploying an Automation Account)
With an Alert naming convention that includes your server name, this method works very well for quickly enabling or disabling Azure alerts.
I hope you have found this article helpful and thank you for taking the time to read this post.
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.