Tutorials

|

10

minutes read

Using Azure Alert Monitoring Resources And Trigger With Automation Runbook

Tom

September 19, 2022

feature image

A better way to debug your PHP code

A better way to debug your PHP code

Khoa Pham

November 16, 2022

Discover iOS Dark Mode Programming

Discover iOS Dark Mode Programming

thomas.le

November 1, 2022

Get to know how to use Azure Alert to monitor resources and triggers with the automation runbook.

What is a Microsoft Azure alert?

Alerts proactively notify you when issues are found with your infrastructure or application using data monitor in Azure Monitor. The alert rule captures the target and criteria for alerting. The alert rule can be in an enabled or a disabled state.

When creating an alert rule, you need to specify the bellow key attributes:

  • Target Resource: defining the scope and signals available for alerting, such as Virtual machines, Storage Account, WebApp, and so on. You can specify multiple resources in an alert rule’s scope with the same resource type.
  • Signal: Emitted by the target resource. Signals can be of the following types: metric, activity log, application insights, and log.
  • Criteria: A combination of signal and logic applied on a target resource (condition to change alert state), such as VM Restart, Run command on VM, Server response time > 9ms, etc.)
  • Alert Name – A specific name for the alert rule configured by the user.
  • Alert Description – A description of the alert rule configured by the user.
  • Severity – The severity of the alert after the criteria specified in the alert rule is met. Severity can range from 0 to 4 (Critical-Error-Warning-Informational-Verbose).
  • Action – A specific action taken when the alert is fired.
how a Microsoft Azure Alert work

How to create Alert Rule To Monitor or Track State Of Resources:

Let’s try creating an Alert Rule to monitor activities and stop a virtual machine.

– Create a new VM in Resource Group

Create a new virtual machine in Resource Group

– Choose menu Alerts

choose Alerts from the left menu

– Click New Alert rule

Scope: Choose subscription and resource group

select a new resource for your alert

– Then click add condition to choose Signal Type as Activity Log and Signal Name as Deallocate Virtual Machine (Microsoft.Compute/virtualMachines)

choose Signal Type as Activity Log and Signal Name as Deallocate Virtual Machine

Alert condition preview

– Click add Action Group > Create Action Group

creating action group for your alert

– For the Notification Type, choose Email/SMS Message/Push/Voice

choose the notification settings

complete the process with some final alert rules

– Then click Review and Create

review and create your alert

– You can power off the VM to check your new alert rule.

power off the VM to check your new alert rule

– The new Alert is generated based on the alert rule

new Alert is generated based on the alert rule

– It also sends alert email notifications.

a screenshot of alert email notifications

How to use an alert to trigger an Azure Automation runbook

By using action groups to automate tasks based on the alert, you can trigger an Azure Automation runbook.

Here’s how to create a runbook to handle alerts.

– Go to your Azure Automation account:

an Azure Automation account first screen

– Create Automation Account

creating a new Automation Account

– Under Process Automation, select Runbooks > select + Create a runbook

Under Process Automation, select Runbooks > select + Create a runbook

Under Process Automation, select Runbooks > select + Create a runbook
Edit your Runbook

– Choose Save > Publish runbook

save and publish your runbook

– You can edit Alert Rule using  > Add new action group for executing new runbook

edit Alert Rule using  > Add new action group

edit Alert Rule using  > Add new action group

– Then click Review + Create > Create > Save Rule

Conclusion

That is how you can manage alerts and trigger them with Automation Runbook in Microsoft Azure. If you are interested in DevOps, you can read more about critical DevOps metrics or learn more about how DevOps can benefit your business.

FABA Technology can provide your company with a comprehensive DevOps strategy to elevate your product’s flow and quality. Reach out to us for a free consultation here.