Sending Your Azure Application Insights Alerts to Team Sites using Azure Logic App

Sending Your Azure Application Insights Alerts to Team Sites using Azure Logic App

Azure Application Insights helps us to monitor applications health in real time. We can track our application availability, performance issues, user’s session and diagnose crashes faster than ever. It provides a real-time dashboard for your app to monitor your application. Azure Application Insights sends different alerts when it is either experiencing failures, unavailability, performance issues or any other potential issues. We can configure different types of alerts based on several sets of metrics. When there is an alert, We can send a notification email to the concern team to take necessary action.

Read Tips & Tricks Related with Azure Application Insights

What next? – If you want to take any further or custom action based on alerts, you may choose Webhook to route an Azure Alerts notification to other Azure services or to an external service. We use a webhook on an alert to route it to services that may create a work item, send SMS alert, notify a team via messaging services, or do any other actions from the responses received.

Well, you can leverage all the above feature much more effetely, when you route your alert directly to Azure Logic App. Logic Apps provides you varieties of the connector to connect with different internal as well as external components. This will make things very easier and faster.

Let’s explore how we can set Azure Application Insights Alerts with Azure Logic App to route the request and push alert information in a Team channel. At a high level, we need to achieve following two tasks

  • Setting up and Configure the Azure Logic App
  • Connect Logic App with Azure Application Insight Alerts

Setting Up & Configure the Azure Logic App

Open the Azure Portal and perform the following task:

• Create an Azure Logic App Service
• From the Logic App Designer – Add a step that Receives an HTTP Request as request Tigger
• Add a Microsoft Team Connector as Action Item post request received.

 

Note: During this setup process, you need to Authenticate to Team Services and you can customize the messages based on the JSON you are receiving the Alert.
In this case, we are just passing the Description and Resource name to a Team Site called “Azure Dev POC Team” and posting the message on the “General” Channel. 

Link the Logic App with Azure Application Insight Alert

From the Azure Portal, open the respective Application Insights resource for which you want to configure the Alert. When you add an “Alert Rule”, you will find an option for “Run a logic app from this alert” at the down bottom section of the setup blade.

Following image shows an overall configuration flow. In this case, we set up an alert for the failed request, and whenever there is a failed request alert, it will trigger Logic App endpoint which eventually posts a message on a Team Site.

Overall, very easy and straightforward setup!

Now, whenever there is an alert for the failed request, your team will receive a message on the team site. You can review the alert in Application Insights and cross-check the corresponding Application Insight Dashboard in the Logic App Run History.

Further, Go back, and check the custom messages on your Team Site.

That’s it.

This is a quick example of how you can leverage Logic App to route your Alerts from Application Insights. Logic Apps provides several connectors, you can leverage them and configure an additional action for application alerts.

Hope this helps.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

2 Comments to “Sending Your Azure Application Insights Alerts to Team Sites using Azure Logic App”

Comments are closed.