Customize alert notifications by using Logic Apps - Azure Monitor (2024)

Edit

Share via

  • Article

This article shows you how to create a logic app and integrate it with an Azure Monitor alert.

You can use Azure Logic Apps to build and customize workflows for integration. Use Logic Apps to customize your alert notifications. You can:

  • Customize the alerts email by using your own email subject and body format.
  • Customize the alert metadata by looking up tags for affected resources or fetching a log query search result. For information on how to access the search result rows that contain alerts data, see:
    • Azure Monitor Log Analytics API response format
    • Query/management HTTP response
  • Integrate with external services by using existing connectors like Outlook, Microsoft Teams, Slack, and PagerDuty. You can also configure the logic app for your own services.

This example creates a logic app that uses the common alerts schema to send details from the alert.

Create a logic app

  1. In the Azure portal, create a new logic app. In the Search bar at the top of the page, enter Logic App.

  2. On the Logic App page, select Add.

  3. Select the Subscription and Resource group for your logic app.

  4. Set Logic App name. For Plan type, select Consumption.

  5. Select Review + create > Create.

  6. Select Go to resource after the deployment is finished.

    Customize alert notifications by using Logic Apps - Azure Monitor (1)

  7. On the Logic Apps Designer page, select When a HTTP request is received.

    Customize alert notifications by using Logic Apps - Azure Monitor (2)

  8. Paste the common alert schema into the Request Body JSON Schema field from the following JSON:

     { "type": "object", "properties": { "schemaId": { "type": "string" }, "data": { "type": "object", "properties": { "essentials": { "type": "object", "properties": { "alertId": { "type": "string" }, "alertRule": { "type": "string" }, "severity": { "type": "string" }, "signalType": { "type": "string" }, "monitorCondition": { "type": "string" }, "monitoringService": { "type": "string" }, "alertTargetIDs": { "type": "array", "items": { "type": "string" } }, "originAlertId": { "type": "string" }, "firedDateTime": { "type": "string" }, "resolvedDateTime": { "type": "string" }, "description": { "type": "string" }, "essentialsVersion": { "type": "string" }, "alertContextVersion": { "type": "string" } } }, "alertContext": { "type": "object", "properties": {} } } } }}

    Customize alert notifications by using Logic Apps - Azure Monitor (3)

  9. (Optional). You can customize the alert notification by extracting information about the affected resource on which the alert fired, for example, the resource's tags. You can then include those resource tags in the alert payload and use the information in your logical expressions for sending the notifications. To do this step, we will:

    • Create a variable for the affected resource IDs.
    • Split the resource ID into an array so that we can use its various elements (for example, subscription and resource group).
    • Use the Azure Resource Manager connector to read the resource's metadata.
    • Fetch the resource's tags, which can then be used in subsequent steps of the logic app.
    1. Select + > Add an action to insert a new step.

    2. In the Search field, search for and select Initialize variable.

    3. In the Name field, enter the name of the variable, such as AffectedResource.

    4. In the Type field, select Array.

    5. In the Value field, select Add dynamic Content. Select the Expression tab and enter the string split(triggerBody()?['data']?['essentials']?['alertTargetIDs'][0], '/').

      Customize alert notifications by using Logic Apps - Azure Monitor (4)

    6. Select + > Add an action to insert another step.

    7. In the Search field, search for and select Azure Resource Manager > Read a resource.

    8. Populate the fields of the Read a resource action with the array values from the AffectedResource variable. In each of the fields, select the field and scroll down to Enter a custom value. Select Add dynamic content, and then select the Expression tab. Enter the strings from this table:

      FieldString value
      Subscriptionvariables('AffectedResource')[2]
      Resource Groupvariables('AffectedResource')[4]
      Resource Providervariables('AffectedResource')[6]
      Short Resource IDconcat(variables('AffectedResource')[7], '/', variables('AffectedResource')[8])
      Client Api VersionResource type's api version

      To find your resource type's api version, select the JSON view link on the top right-hand side of the resource overview page.The Resource JSON page is displayed with the ResourceID and API version at the top of the page.

    The dynamic content now includes tags from the affected resource. You can use those tags when you configure your notifications as described in the following steps.

  10. Send an email or post a Teams message.

  11. Select + > Add an action to insert a new step.

    Customize alert notifications by using Logic Apps - Azure Monitor (5)

  • Send an email
  • Post a Teams message
  1. In the search field, search for Outlook.

  2. Select Office 365 Outlook.

    Customize alert notifications by using Logic Apps - Azure Monitor (6)

  3. Select Send an email (V2) from the list of actions.

  4. Sign in to Office 365 when you're prompted to create a connection.

  5. Create the email Body by entering static text and including content taken from the alert payload by choosing fields from the Dynamic content list.For example:

    • An alert has monitoring condition: Select monitorCondition from the Dynamic content list.
    • Date fired: Select firedDateTime from the Dynamic content list.
    • Affected resources: Select alertTargetIDs from the Dynamic content list.
  6. In the Subject field, create the subject text by entering static text and including content taken from the alert payload by choosing fields from the Dynamic content list. For example:

    • Alert: Select alertRule from the Dynamic content list.
    • with severity: Select severity from the Dynamic content list.
    • has condition: Select monitorCondition from the Dynamic content list.
  7. Enter the email address to send the alert to the To field.

  8. Select Save.

    Customize alert notifications by using Logic Apps - Azure Monitor (7)

You've created a logic app that sends an email to the specified address, with details from the alert that triggered it.

The next step is to create an action group to trigger your logic app.

Create an action group

To trigger your logic app, create an action group. Then create an alert that uses that action group.

  1. Go to the Azure Monitor page and select Alerts from the pane on the left.

  2. Select Action groups > Create.

  3. Select values for Subscription, Resource group, and Region.

  4. Enter a name for Action group name and Display name.

  5. Select the Actions tab.

    Customize alert notifications by using Logic Apps - Azure Monitor (8)

  6. On the Actions tab under Action type, select Logic App.

  7. In the Logic App section, select your logic app from the dropdown.

  8. Set Enable common alert schema to Yes. If you select No, the alert type determines which alert schema is used. For more information about alert schemas, see Context-specific alert schemas.

  9. Select OK.

  10. Enter a name in the Name field.

  11. Select Review + create > Create.

    Customize alert notifications by using Logic Apps - Azure Monitor (9)

Test your action group

  1. Select your action group.

  2. In the Logic App section, select Test action group (preview).

    Customize alert notifications by using Logic Apps - Azure Monitor (10)

  3. Select a sample alert type from the Select sample type dropdown.

  4. Select Test.

    Customize alert notifications by using Logic Apps - Azure Monitor (11)

    The following email is sent to the specified account:

    Customize alert notifications by using Logic Apps - Azure Monitor (12)

Create a rule by using your action group

  1. Create a rule for one of your resources.

  2. On the Actions tab of your rule, choose Select action groups.

  3. Select your action group from the list.

  4. Choose Select.

  5. Finish the creation of your rule.

    Customize alert notifications by using Logic Apps - Azure Monitor (13)

Next steps

  • Learn more about action groups
  • Learn more about the common alert schema

Feedback

Was this page helpful?

Customize alert notifications by using Logic Apps - Azure Monitor (2024)

FAQs

Customize alert notifications by using Logic Apps - Azure Monitor? ›

Azure Monitor is the built-in monitoring solution offered by Microsoft Azure, which helps you collect and analyze monitoring data from cloud and on-premises environments. Azure Monitor alerts are automated notifications that provide insights into the status of Azure resources.

What is the difference between Azure Monitor and Azure alerts? ›

Azure Monitor is the built-in monitoring solution offered by Microsoft Azure, which helps you collect and analyze monitoring data from cloud and on-premises environments. Azure Monitor alerts are automated notifications that provide insights into the status of Azure resources.

What are the three main parts of an Azure Monitor Alert rule? ›

An alert rule combines:
  • The resources to be monitored.
  • The signal or data from the resource.
  • Conditions.
Sep 11, 2024

Which of the following components are required for Azure Monitor Alerts? ›

Which of the following components are required for Azure Monitor alerts? Alert Rule - provides the conditions that must be met before triggering an alert. Action Group - After an alert is triggered via an alert rule, the action group designates who is informed of the triggered alert.

Does Azure Monitor allow you to create alerts from log queries? ›

Azure Monitor alerts proactively notify you when important conditions are found in your monitoring data. Log search alert rules create an alert when a log query returns a particular result.

What are the three main functions of Azure Monitor? ›

Azure Monitor's core consumption methods include tools to provide insights, visualize, and analyze data. The visualization tools build on the analysis tools and the insights build on top of both the visualization and analysis tools.

What is the difference between alert and Monitor? ›

A set of software components used for data collection, their processing, and presentation is called a monitoring system. Alerting is the capability of a monitoring system to detect and notify the operators about meaningful events that denote a grave change of state.

How to configure alerts in Azure monitor? ›

In the Azure portal
  1. On the Alerts screen in Azure Monitor, select Alert rules.
  2. In the Subscription dropdown control, filter to the subscription you want. ...
  3. In the Signal type dropdown control, select Log Search.
  4. Verify that the Status dropdown control is set to Enabled.
Sep 11, 2024

Can Azure monitor trigger alerts? ›

Azure Monitor alert rules let you select which action groups will be triggered when their alerts are fired. However, not all Azure alert sources let you specify action groups. Some examples of such alerts include Azure Backup alerts, VM Insights guest health alerts, Azure Stack Edge, and Azure Stack Hub.

What are the different types of alerts? ›

There are 4 different types of alert — neutral, positive, warning, and negative. Each has a different use case. Use a neutral alert to give users contextual hints or general information. Use a positive alert to tell a user about something that's resolved, or now available due to their action.

What are logic apps? ›

Azure Logic Apps helps you seamlessly connect disparate systems across cloud, on-premises, and hybrid environments. For example, you can connect a cloud marketing solution to an on-premises billing system, or centralize messaging across APIs and systems using Azure Service Bus.

Which component of Azure Monitor Monitors logic apps? ›

Azure Monitor tools
  • Metrics explorer, a tool in the Azure portal that allows you to view and analyze metrics for Azure resources. ...
  • Log Analytics, a tool in the Azure portal that allows you to query and analyze log data by using the Kusto query language (KQL).
Jul 11, 2024

How to get email notification for alert in Azure? ›

Customize the email notifications in the portal
  1. Sign in to the Azure portal.
  2. Navigate to Microsoft Defender for Cloud > Environment settings.
  3. Select the relevant subscription.
  4. Select email notifications.
  5. Define the recipients for your notifications with one or both of these options: ...
  6. Select the notification types:
Aug 7, 2024

How many types of Azure Alerts are there? ›

Alert types

The most common types of alert rules in Azure Monitor are metric alerts and log search alerts. The type of alert rule that you create for a particular scenario depends on where the data that you're alerting on is located.

How to create Azure Monitor alerts for non compliant Azure policies? ›

Follow the following steps to create the alert rule via the portal:
  1. Browse to Azure Monitor and click on Alerts blade.
  2. Click on New alert rules.
  3. On the Create rule page, select the appropriate subscription and the Log Analytics workspace.
  4. Add a condition, on the Configure signal logic page, select Custom log search.
Jul 2, 2019

What is the difference between Azure Monitor and Azure Insights? ›

In summary, Azure Application Insights focuses on monitoring the performance and user behavior of applications, while Azure Monitor provides a broader scope of monitoring for applications, infrastructure, and operating systems.

Can an Azure Monitor send alerts? ›

Keep in mind that activity log alerts, service health alerts, and resource health alerts are free of charge. Azure Monitor activity alerts, service health alerts and resource health alerts are free.

What does an Azure Monitor do? ›

Azure Monitor is a scalable cloud service that processes and stores large amounts of data, although Azure Monitor can monitor resources that are on-premises and in other clouds.

What is the difference between Azure metrics and Azure Monitor? ›

Metrics are numerical values that are collected at regular intervals and describe some aspect of a system at a particular time. Azure Monitor Metrics is one half of the data platform that supports Azure Monitor. The other half is Azure Monitor Logs, which collects and organizes log and performance data.

Top Articles
Sharlife - Crypto Shariah Status
Private Banking - Private Bank Accounts | HSBC UK
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 5976

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.