|
1 | 1 | ---
|
2 |
| -title: Connect to Azure Monitor Application Insights |
3 |
| -description: Connect to Azure Application Insights to query telemetry data as part of a workflow in Azure Logic Apps. |
| 2 | +title: Connect to Azure Application Insights |
| 3 | +description: Connect to Application Insights from a workflow in Azure Logic Apps. |
4 | 4 | services: logic-apps
|
5 | 5 | ms.suite: integration
|
6 | 6 | ms.reviewer: estfan, azla
|
7 | 7 | ms.topic: how-to
|
8 |
| -ms.date: 07/31/2022 |
| 8 | +ms.date: 03/07/2023 |
9 | 9 | tags: connectors
|
| 10 | +# As a developer, I want to get telemetry from an Application Insights resource to use with my workflow in Azure Logic Apps. |
10 | 11 | ---
|
11 | 12 |
|
12 |
| -# Connect to Azure Monitor Application Insights from workflows in Azure Logic Apps |
13 |
| - |
14 |
| -Do you find yourself repeatedly running the same queries on your telemetry data to check whether 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 [Application Insights connector](/connectors/applicationinsights/) for Azure Logic Apps is the right tool for this purpose. |
| 13 | +# Connect to Azure Application Insights from workflows in Azure Logic Apps |
15 | 14 |
|
16 | 15 | > [!NOTE]
|
17 |
| -> The Application Insights connector is replaced by the [Azure Monitor connector](../connectors/connectors-azure-monitor-logs.md), which you can also use to retrieve data from a Log Analytics workspace. |
18 |
| -> Rather than require an API key, the Azure Monitor connector is integrated with Azure Active Directory. |
19 |
| -
|
20 |
| -With this integration, you can automate numerous processes without writing a single line of code. You can create a logic app workflow with the Application Insights connector to quickly automate any Application Insights process. |
21 |
| - |
22 |
| -You can also add other actions. Azure Logic Apps provides hundreds of connectors with other actions. For example, by creating a logic app workflow, you can automatically send an email notification or create a bug in Azure DevOps. If you're creating a Consumption logic app workflow, you can also use one of the many available [templates](../logic-apps/logic-apps-create-logic-apps-from-templates.md) to help speed up the process of creating your workflow. |
23 |
| - |
24 |
| -This how-to guide describes how to build a workflow using the connector. |
25 |
| - |
26 |
| -## Create a logic app workflow for Application Insights |
27 |
| - |
28 |
| -In this tutorial, you learn how to create a logic app that uses the Log Analytics autocluster algorithm to group attributes in the data for a web application. The flow automatically sends the results by email. This example shows how you can use Application Insights analytics and Logic Apps together. |
29 |
| - |
30 |
| -### Create a logic app |
31 |
| -1. Sign in to the [Azure portal](https://portal.azure.com). |
32 |
| -1. Select **Create a resource** > **Web** > **Logic App**. For this example, make sure that you create a Consumption logic app workflow. If you create a Standard logic app, your designer experience will differ and not all steps apply. |
33 |
| - |
34 |
| -  |
35 |
| - |
36 |
| -### Add a trigger for your workflow |
37 |
| -1. In the **Logic Apps Designer** window, under **Start with a common trigger**, select **Recurrence**. |
38 |
| - |
39 |
| -  |
40 |
| - |
41 |
| -1. In the **Interval** box, enter **1**. In the **Frequency** box, select **Day**. |
42 |
| - |
43 |
| -  |
44 |
| - |
45 |
| -### Add an Application Insights action |
46 |
| - |
47 |
| -1. Select **New step**. |
48 |
| - |
49 |
| -1. In the **Choose an action** search box, enter **Application Insights**. |
50 |
| - |
51 |
| -1. Under **Actions**, select **Visualize Analytics query - Azure Application Insights**. |
52 |
| - |
53 |
| -  |
54 |
| - |
55 |
| -### Connect to an Application Insights resource |
56 |
| - |
57 |
| -For this step, you need an application ID and an API key for your resource. |
58 |
| - |
59 |
| -1. In the Azure portal, open your Application Insights resource. |
60 |
| - |
61 |
| -1. On the resource menu, under **Configure**, select **API Access**. On the toolbar, select **Create API key**. |
62 |
| - |
63 |
| -  |
64 |
| - |
65 |
| -  |
66 |
| - |
67 |
| -1. Provide a connection name, the application ID, and the API key. |
68 |
| - |
69 |
| -  |
70 |
| - |
71 |
| -### Specify the Log Analytics query and chart type |
72 |
| -In the following example, the query selects the failed requests within the last day and correlates them with exceptions that occurred as part of the operation. Log Analytics correlates the failed requests based on the `operation_Id` identifier. The query then segments the results by using the autocluster algorithm. |
73 |
| - |
74 |
| -When you create your own queries, verify that they're working properly in Log Analytics before you add them to your flow. |
75 |
| - |
76 |
| -1. In the **Query** box, add the following Log Analytics query: |
77 |
| - |
78 |
| - ``` |
79 |
| - requests |
80 |
| - | where timestamp > ago(1d) |
81 |
| - | where success == "False" |
82 |
| - | project name, operation_Id |
83 |
| - | join ( exceptions |
84 |
| - | project problemId, outerMessage, operation_Id |
85 |
| - ) on operation_Id |
86 |
| - | evaluate autocluster() |
87 |
| - ``` |
88 |
| -
|
89 |
| -1. In the **Chart Type** box, select **Html Table**. |
90 |
| -
|
91 |
| -  |
92 |
| -
|
93 |
| -### Add an action to send email |
94 |
| -
|
95 |
| -1. Select **New step**. |
96 |
| -
|
97 |
| -1. In the search box, enter **Office 365 Outlook**. |
98 |
| -
|
99 |
| -1. Select **Send an email - Office 365 Outlook**. |
100 |
| -
|
101 |
| -  |
102 |
| -
|
103 |
| -1. In the **Send an email** action, set up the following properties: |
104 |
| -
|
105 |
| - 1. Enter the email address of the recipient. |
106 |
| - 1. Enter a subject for the email. |
107 |
| - 1. In the **Body** box, select anywhere inside. When the **Dynamic content** list appears. under **Visualize Analytics query**, select **Body**. |
108 |
| - 1. From the **Add new parameter** list, select **Attachments** and **Is HTML**. |
109 |
| -
|
110 |
| -  |
111 |
| -
|
112 |
| -  |
113 |
| -
|
114 |
| - The **Send an email** action now includes the **Attachments Name**, **Attachments Content**, and **IsHtml** properties. |
115 |
| -
|
116 |
| - 1. For the new properties, follow these steps: |
117 |
| -
|
118 |
| - 1. In the **Attachment Name** box, from the dynamic content list that appears, select the **Attachment Name** output. |
119 |
| - 1. In the **Attachment Content** box, from the dynamic content list that appears, select the **Attachment Content** output. |
120 |
| - 1. In the **Is HTML** box, select **Yes**. |
121 |
| -
|
122 |
| -  |
123 |
| -
|
124 |
| -### Save and test your logic app workflow |
125 |
| -
|
126 |
| -1. On the designer toolbar, select **Save** to save your changes. |
127 |
| -
|
128 |
| - You can wait for the trigger to run the workflow, or you can immediately run the workflow by selecting **Run Trigger** > **Run**. |
129 |
| -
|
130 |
| -  |
131 |
| -
|
132 |
| - When your workflow runs, the specified email recipients receive an email that looks like the following example: |
133 |
| -
|
134 |
| -  |
135 |
| -
|
136 |
| - > [!NOTE] |
137 |
| - > The logic app workflow generates an email with a JPG file that depicts the query result set. If your query doesn't return results, the workflow won't create a JPG file. |
| 16 | +> |
| 17 | +> The [Azure Monitor Logs connector](/connectors/azuremonitorlogs/) replaces the [Azure Log Analytics connector](/connectors/azureloganalytics/) |
| 18 | +> and the [Azure Application Insights connector](/connectors/applicationinsights/). This combined connector provides the same functionality as |
| 19 | +> the other connectors and is the preferred method for running a query against a Log Analytics workspace or an Application Insights resource. |
| 20 | +> |
| 21 | +> For example, when you connect to your Application Insights resource, you don't have to create or provide an application ID and API key. |
| 22 | +> Authentication is integrated with Azure Active Directory. For the how-to guide to use the Azure Monitor Logs connector, see |
| 23 | +> [Connect to Log Analytics or Application Insights from workflows in Azure Logic Apps](connectors-azure-monitor-logs.md). |
138 | 24 |
|
139 | 25 | ## Next steps
|
140 | 26 |
|
141 |
| -Learn more about: |
142 |
| -- [Log Analytics queries](../azure-monitor/logs/get-started-queries.md) |
143 |
| -- [Azure Logic Apps](../logic-apps/logic-apps-overview.md) |
144 |
| -- [Application Insights connector](/connectors/applicationinsights/) |
| 27 | +- Learn more about the [Azure Monitor Logs connector](/connectors/azuremonitorlogs/) |
| 28 | +- Learn how to [Connect to Log Analytics or Application Insights from workflows in Azure Logic Apps](connectors-azure-monitor-logs.md) |
| 29 | +- Learn more about [Azure Logic Apps](../logic-apps/logic-apps-overview.md)- |
0 commit comments