Creating an alert
To create an alert, perform the following steps:
- Navigate to the Monitor blade.
- From the left-hand menu, select Alerts. Click + Create and then click Alert rule:

Figure 20.22 – Creating an alert
- You will be prompted to select a resource on the right of the screen. Select the subscription where your VM from the previous exercises resides and select Virtual machines from the Filter by resource type dropdown. Select your VM from the list and then click Done:

Figure 20.23 – Select a resource for alerts
- Click Next: Condition >.
- Now, you will configure the condition that will trigger the alert. On the right-hand side, you will be prompted to configure a signal, which is what alerts you to a condition being met and is the precursor to triggering the alert. Enter CPU in the search bar and select Percentage CPU from the options.
- Configure Alert logic as follows and click Done:

Figure 20.24 – Alert logic
- Your condition has been configured to assess your CPU usage percentage when it exceeds 70% over a period of 1 minute. Frequency of evaluation is how long until it fires off an alert again (should an existing alert not still be active). Click Next: Actions >.
- To receive an alert, you will need to have an action group configured, of which you currently have none. Click + Create action group.
- Configure the following settings and click Next: Notifications >:
- Subscription: Select your Azure subscription.
- Resource group: AZ104-Monitor.
- Action group name: emailme.
- Display name: emailme.
- Select Email/SMS message/Push/Voice as Notification type. The right-hand screen will pop up with a prompt for details. Select the checkbox next to Email and enter your email address. Click OK.
- Enter a name, such as PersonalEmail, and click Next: Actions >:

Figure 20.25 – The action group notification type
- Note that you can configure several types of actions, such as firing off a logic app or function; this can be really powerful, especially where you need to adopt an automated remediation strategy.
- Click Review + create. If you wish, you can click Test action group to get sent an example email to confirm that the action group is working as expected:

Figure 20.26 – Testing your action group
- Click Create. Now that you have your action group, click Next: Details >.
- Enter the following details.
- Subscription: Select your Azure subscription.
- Resource group: AZ104-Monitor.
- Severity: 0 – Critical.
- Alert rule name: CPU High.
- Enable upon creation: Checked.
- Automatically resolve alerts: Checked.
- Click Review + create and then click Create.
We have now created an alert and an action group that will alert a user via email when the CPU goes over 70% over a period of 1 minute. In the next section, we’re going to configure diagnostic settings on resources.