Skip to content

Commit e065588

Browse files
Merge pull request #104784 from bwren/am-logic-app
Azure Monitor logic app connector
2 parents 5ca75ec + e5c6912 commit e065588

23 files changed

+134
-212
lines changed

.openpublishing.redirection.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41779,6 +41779,16 @@
4177941779
"redirect_url": "/azure/azure-monitor/platform/diagnostic-settings-legacy",
4178041780
"redirect_document_id": false
4178141781
},
41782+
{
41783+
"source_path": "articles/azure-monitor/platform/flow-tutorial.md",
41784+
"redirect_url": "/azure/azure-monitor/platform/logicapp-flow-connector",
41785+
"redirect_document_id": false
41786+
},
41787+
{
41788+
"source_path": "articles/azure-monitor/app/automate-with-flow.md",
41789+
"redirect_url": "/azure/azure-monitor/platform/logicapp-flow-connector",
41790+
"redirect_document_id": false
41791+
},
4178241792
{
4178341793
"source_path": "articles/azure-monitor/platform/azure-storage-iis-table.md",
4178441794
"redirect_url": "/azure/azure-monitor/platform/diagnostics-extension-logs",

articles/azure-monitor/app/automate-with-flow.md

Lines changed: 0 additions & 130 deletions
This file was deleted.

articles/azure-monitor/app/automate-with-logic-apps.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ ms.date: 03/11/2019
1010

1111
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 Azure Application Insights connector for Logic Apps is the right tool for this purpose.
1212

13+
> [!NOTE]
14+
> The Azure Application Insights connector has been replaced with the [Azure Monitor connector](../platform/logicapp-flow-connector.md) that is integrated with Azure Active Directory instead of requiring an API key and also allows you to retrieve data from a Log Analytics workspace.
15+
1316
With this integration, you can automate numerous processes without writing a single line of code. You can create a logic app with the Application Insights connector to quickly automate any Application Insights process.
1417

1518
You can add additional actions as well. The Logic Apps feature of Azure App Service makes hundreds of actions available. For example, by using a logic app, you can automatically send an email notification or create a bug in Azure DevOps. You can also use one of the many available [templates](https://docs.microsoft.com/azure/logic-apps/logic-apps-use-logic-app-templates) to help speed up the process of creating your logic app.

articles/azure-monitor/platform/flow-tutorial.md

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: Use Azure Monitor Logs with Azure Logic Apps and Power Automate
3+
description: Learn how you can use Azure Logic Apps and Power Automate to quickly automate repeatable processes by using the Azure Monitor connector.
4+
ms.service: azure-monitor
5+
ms.subservice: logs
6+
ms.topic: conceptual
7+
author: bwren
8+
ms.author: bwren
9+
ms.date: 03/13/2020
10+
11+
---
12+
13+
# Azure Monitor Logs connector for Logic Apps and Flow
14+
[Azure Logic Apps](/azure/logic-apps/) and [Power Automate](https://ms.flow.microsoft.com) allow you to create automated workflows using hundreds of actions for a variety of services. The Azure Monitor Logs connector allows you to build workflows that retrieve data from a Log Analytics workspace or an Application Insights application in Azure Monitor. This article describes the actions included with the connector and provides a walkthrough to build a workflow using this data.
15+
16+
For example, you can create a logic app to use Azure Monitor log data in an email notification from Office 365, create a bug in Azure DevOps, or post a Slack message. You can trigger a workflow by a simple schedule or from some action in a connected service such as when a mail or a tweet is received.
17+
18+
## Actions
19+
The following table describes the actions included with the Azure Monitor Logs connector. Both allow you to run a log query against a Log Analytics workspace or Application Insights application. The difference is in the way the data is returned.
20+
21+
> [!NOTE]
22+
> The Azure Monitor Logs connector replaces the [Azure Log Analytics connector](https://docs.microsoft.com/connectors/azureloganalytics/) and the [Azure Application Insights connector](https://docs.microsoft.com/connectors/applicationinsights/). This connector provides the same functionality as the others and is the preferred method for running a query against a Log Analytics workspace or an Application Insights application.
23+
24+
25+
| Action | Description |
26+
|:---|:---|
27+
| [Run query and and list results](https://docs.microsoft.com/connectors/azuremonitorlogs/#run-query-and-list-results) | Returns each row as its own object. Use this action when you want to work with each row separately in the rest of the workflow. The action is typically followed by a [For each activity](../../logic-apps/logic-apps-control-flow-loops.md#foreach-loop). |
28+
| [Run query and and visualize results](https://docs.microsoft.com/connectors/azuremonitorlogs/#run-query-and-visualize-results) | Returns all rows in the result set as a single formatted object. Use this action when you want to use the result set together in the rest of the workflow, such as sending the results in a mail. |
29+
30+
## Walkthroughs
31+
The following tutorials illustrate the use of the Azure Monitor connectors in Azure Logic Apps. You can perform these same example with Power Automate, the only difference being how to you create the initial workflow and run it when complete. Configuration of the workflow and actions is the same between both. See [Create a flow from a template in Power Automate](https://docs.microsoft.com/power-automate/get-started-logic-template) to get started.
32+
33+
34+
### Create a Logic App
35+
36+
Go to **Logic Apps** in the Azure portal and click **Add**. Select a **Subscription**, **Resource group**, and **Region** to store the new logic app and then give it a unique name. You can turn on **Log Analytics** setting to collect information about runtime data and events as described in [Set up Azure Monitor logs and collect diagnostics data for Azure Logic Apps](../../logic-apps/monitor-logic-apps-log-analytics.md). This setting isn't required for using the Azure Monitor Logs connector.
37+
38+
![Create logic app](media/logicapp-flow-connector/create-logic-app.png)
39+
40+
41+
Click **Review + create** and then **Create**. When the deployment is complete, click **Go to resource** to open the **Logic Apps Designer**.
42+
43+
### Create a trigger for the logic app
44+
Under **Start with a common trigger**, select **Recurrence**. This creates a logic app that automatically runs at a regular interval. In the **Frequency** box of the action, select **Day** and in the **Interval** box, enter **1** to run the workflow once per day.
45+
46+
![Recurrence action](media/logicapp-flow-connector/recurrence-action.png)
47+
48+
## Walkthrough: Mail visualized results
49+
The following tutorial shows you how to create a logic app that sends the results of an Azure Monitor log query by email.
50+
51+
### Add Azure Monitor Logs action
52+
Click **+ New step** to add an action that runs after the recurrence action. Under **Choose an action**, type **azure monitor** and then select **Azure Monitor Logs**.
53+
54+
![Azure Monitor Logs action](media/logicapp-flow-connector/select-azure-monitor-connector.png)
55+
56+
Click **Azure Log Analytics – Run query and visualize results**.
57+
58+
![Run query and visualize results action](media/logicapp-flow-connector/select-query-action-visualize.png)
59+
60+
61+
### Add Azure Monitor Logs action
62+
63+
Select the **Subscription** and **Resource Group** for your Log Analytics workspace. Select *Log Analytics Workspace* for the **Resource Type** and then select the workspace's name under **Resource Name**.
64+
65+
Add the following log query to the **Query** window.
66+
67+
```Kusto
68+
Event
69+
| where EventLevelName == "Error"
70+
| where TimeGenerated > ago(1day)
71+
| summarize TotalErrors=count() by Computer
72+
| sort by Computer asc
73+
```
74+
75+
Select *Set in query* for the **Time Range** and **HTML Table** for the **Chart Type**.
76+
77+
![Run query and visualize results action](media/logicapp-flow-connector/run-query-visualize-action.png)
78+
79+
The mail will be sent by the account associated with the current connection. You can specify another account by clicking on **Change connection**.
80+
81+
### Add email action
82+
83+
Click **+ New step**, and then click **+ Add an action**. Under **Choose an action**, type **outlook** and then select **Office 365 Outlook**.
84+
85+
![Select Outlook connector](media/logicapp-flow-connector/select-outlook-connector.png)
86+
87+
Select **Send an email (V2)**.
88+
89+
![Office 365 Outlook selection window](media/logicapp-flow-connector/select-mail-action.png)
90+
91+
Click anywhere in the **Body** box to open a **Dynamic content** window opens with values from the previous actions in the logic app. Select **See more** and then **Body** which is the results of the query in the Log Analytics action.
92+
93+
![Select body](media/logicapp-flow-connector/select-body.png)
94+
95+
Specify the email address of a recipient in the **To** window and a subject for the email in **Subject**.
96+
97+
![Mail action](media/logicapp-flow-connector/mail-action.png)
98+
99+
100+
### Save and test your logic app
101+
Click **Save** and then **Run** to perform a test run of the logic app.
102+
103+
![Save and run](media/logicapp-flow-connector/save-run.png)
104+
105+
106+
When the logic app completes, check the mail of the recipient that you specified. You should have received a mail with a body similar to the following:
107+
108+
![Sample email](media/logicapp-flow-connector/sample-mail.png)
109+
110+
111+
112+
## Next steps
113+
114+
- Learn more about [log queries in Azure Monitor](../log-query/log-query-overview.md).
115+
- Learn more about [Logic Apps](/azure/logic-apps/)
116+
- Learn more about [Microsoft Flow](https://ms.flow.microsoft.com).
117+
47.1 KB
Loading
29.7 KB
Loading
19.3 KB
Loading
41.3 KB
Loading
12.5 KB
Loading

0 commit comments

Comments
 (0)