Skip to content

Commit ed29e72

Browse files
authored
Merge pull request #4 from ecfan/patch-1
Editorial revisions and refactoring
2 parents bf0f8c2 + 75b662f commit ed29e72

33 files changed

+170
-211
lines changed
Lines changed: 16 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,29 @@
11
---
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.
44
services: logic-apps
55
ms.suite: integration
66
ms.reviewer: estfan, azla
77
ms.topic: how-to
8-
ms.date: 07/31/2022
8+
ms.date: 03/07/2023
99
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.
1011
---
1112

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
1514

1615
> [!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-
![Screenshot that shows the New resource window with Web and Logic App selected.](./media/connectors-azure-application-insights/1createlogicapp.png)
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-
![Screenshot that shows the Logic Apps Designer window with the common triggers gallery and the Recurrence trigger selected.](./media/connectors-azure-application-insights/2logicappdesigner.png)
40-
41-
1. In the **Interval** box, enter **1**. In the **Frequency** box, select **Day**.
42-
43-
![Screenshot that shows the Consumption workflow designer and the Recurrence trigger with Interval and Frequency recurrence properties.](./media/connectors-azure-application-insights/3recurrence.png)
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-
![Screenshot that shows the Choose an operation search box and the Visualize Analytics query action selected.](./media/connectors-azure-application-insights/4visualize.png)
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-
![Screenshot that shows the Azure portal and Application Insights resource with API Access page and the Create API key button selected.](./media/connectors-azure-application-insights/5apiaccess.png)
64-
65-
![Screenshot that shows the Create API key pane with key description and permissions for other apps selected.](./media/connectors-azure-application-insights/6apikey.png)
66-
67-
1. Provide a connection name, the application ID, and the API key.
68-
69-
![Screenshot that shows the Consumption workflow with the Azure Application Insights connection information.](./media/connectors-azure-application-insights/7connection.png)
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-
![Screenshot that shows the Log Analytics query configuration window.](./media/connectors-azure-application-insights/8query.png)
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-
![Screenshot that shows the Office 365 Outlook actions and the Send an email action selected.](./media/connectors-azure-application-insights/9sendemail.png)
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-
![Screenshot that shows the Send an email action, the Body property, and the Dynamic content list to the right side with the Body output selected.](./media/connectors-azure-application-insights/10emailbody.png)
111-
112-
![Screenshot that shows the Send an email action with the Add new parameter list open and the Attachments and Is HTML checkboxes selected.](./media/connectors-azure-application-insights/11emailparameter.png)
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-
![Screenshot that shows the configured Send an email action.](./media/connectors-azure-application-insights/12emailattachment.png)
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-
![Screenshot that shows the Consumption workflow designer with the Save button selected.](./media/connectors-azure-application-insights/13save.png)
131-
132-
When your workflow runs, the specified email recipients receive an email that looks like the following example:
133-
134-
![Screenshow that shows an email message generated by the example Consumption workflow with a query result set.](./media/connectors-azure-application-insights/email-generated-by-logic-app-generated-email.png)
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).
13824
13925
## Next steps
14026

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

Comments
 (0)