Skip to content

Files

Latest commit

17d98d4 · Nov 1, 2017

History

History
133 lines (80 loc) · 5.93 KB

app-insights-automate-with-flow.md

File metadata and controls

133 lines (80 loc) · 5.93 KB

title: Automate Azure Application Insights processes with Microsoft Flow description: Learn how you can use Microsoft Flow to quickly automate repeatable processes by using the Application Insights connector. services: application-insights documentationcenter: '' author: mrbullwinkle manager: carmonm ms.service: application-insights ms.workload: tbd ms.tgt_pltfrm: ibiza ms.devlang: na ms.topic: article ms.date: 06/25/2017 ms.author: mbullwin

Automate Azure Application Insights processes with the connector for Microsoft Flow

Do you find yourself repeatedly running the same queries on your telemetry data to check that your service is functioning properly? Are you looking to automate these queries for finding trends and anomalies and then build your own workflows around them? The Azure Application Insights connector (preview) for Microsoft Flow is the right tool for these purposes.

With this integration, you can now automate numerous processes without writing a single line of code. After you create a flow by using an Application Insights action, the flow automatically runs your Application Insights Analytics query.

You can add additional actions as well. Microsoft Flow makes hundreds of actions available. For example, you can use Microsoft Flow to automatically send an email notification or create a bug in Visual Studio Team Services. You can also use one of the many templates that are available for the connector for Microsoft Flow. These templates speed up the process of creating a flow.

Create a flow for Application Insights

In this tutorial, you will learn how to create a flow that uses the Analytics auto-cluster algorithm to group attributes in the data for a web application. The flow automatically sends the results by email, just one example of how you can use Microsoft Flow and Application Insights Analytics together.

Step 1: Create a flow

  1. Sign in to Microsoft Flow, and then select My Flows.
  2. Click Create a flow from blank.

Step 2: Create a trigger for your flow

  1. Select Schedule, and then select Schedule - Recurrence.

  2. In the Frequency box, select Day, and in the Interval box, enter 1.

    Microsoft Flow trigger dialog box

Step 3: Add an Application Insights action

  1. Click New step, and then click Add an action.

  2. Search for Azure Application Insights.

  3. Click Azure Application Insights – Visualize Analytics query Preview.

    Run Analytics query window

Step 4: Connect to an Application Insights resource

To complete this step, you need an application ID and an API key for your resource. You can retrieve them from the Azure portal, as shown in the following diagram:

Application ID in the Azure portal

  • Provide a name for your connection, along with the application ID and API key.

    Microsoft Flow connection window

Step 5: Specify the Analytics query and chart type

This example query selects the failed requests within the last day and correlates them with exceptions that occurred as part of the operation. Analytics correlates them based on the operation_Id identifier. The query then segments the results by using the autocluster algorithm.

When you create your own queries, verify that they are working properly in Analytics before you add it to your flow.

  • Add the following Analytics query, and then select the HTML table chart type.

    requests
    | where timestamp > ago(1d)
    | where success == "False"
    | project name, operation_Id
    | join ( exceptions
        | project problemId, outerMessage, operation_Id
    ) on operation_Id
    | evaluate autocluster()
    

    Analytics query configuration window

Step 6: Configure the flow to send email

  1. Click New step, and then click Add an action.

  2. Search for Office 365 Outlook.

  3. Click Office 365 Outlook – Send an email.

    Office 365 Outlook selection window

  4. In the Send an email window, do the following:

    a. Type the email address of the recipient.

    b. Type a subject for the email.

    c. Click anywhere in the Body box and then, on the dynamic content menu that opens at the right, select Body.

    d. Click Show advanced options.

    Office 365 Outlook configuration

  5. On the dynamic content menu, do the following:

    a. Select Attachment Name.

    b. Select Attachment Content.

    c. In the Is HTML box, select Yes.

    Office 365 email configuration window

Step 7: Save and test your flow

  • In the Flow name box, add a name for your flow, and then click Create flow.

    Flow-creation window

You can wait for the trigger to run this action, or you can run the flow immediately by running the trigger on demand.

When the flow runs, the recipients you have specified in the email list receive an email message that looks like the following:

Sample email

Next steps