|
1 | 1 | ---
|
2 | 2 | title: Automate custom reports with Application Insights data
|
3 |
| -description: Automate custom daily/weekly/monthly reports with Azure Monitor Application Insights data |
| 3 | +description: Automate custom daily, weekly, and monthly reports with Azure Monitor Application Insights data. |
4 | 4 | ms.topic: conceptual
|
5 | 5 | ms.date: 05/20/2019
|
6 | 6 | ms.reviewer: tilee
|
7 | 7 | ---
|
8 | 8 |
|
9 | 9 | # Automate custom reports with Application Insights data
|
10 | 10 |
|
11 |
| -Periodical reports help keep a team informed on how their business critical services are doing. Developers, DevOps/SRE teams, and their managers can be productive with automated reports reliably delivering insights without requiring everyone to sign in the portal. Such reports can also help identify gradual increases in latencies, load or failure rates that may not trigger any alert rules. |
| 11 | +Periodical reports help keep a team informed on how their business-critical services are doing. Developers, DevOps/SRE teams, and their managers can be productive with automated reports that reliably deliver insights without requiring everyone to sign in to the portal. Such reports can also help identify gradual increases in latencies, load, or failure rates that might not trigger any alert rules. |
12 | 12 |
|
13 | 13 | Each enterprise has its unique reporting needs, such as:
|
14 | 14 |
|
15 |
| -* Specific percentile aggregations of metrics, or custom metrics in a report. |
16 |
| -* Have different reports for daily, weekly, and monthly roll-ups of data for different audiences. |
17 |
| -* Segmentation by custom attributes like region, or environment. |
18 |
| -* Group some AI resources together in a single report, even if they may be in different subscriptions or resource groups etc. |
19 |
| -* Separate reports containing sensitive metrics sent to selective audience. |
20 |
| -* Reports to stakeholders who may not have access to the portal resources. |
| 15 | +* Specific percentile aggregations of metrics or custom metrics in a report. |
| 16 | +* Different reports for daily, weekly, and monthly roll-ups of data for different audiences. |
| 17 | +* Segmentation by custom attributes like region or environment. |
| 18 | +* AI resources grouped together in a single report, even if they might be in different subscriptions or resource groups. |
| 19 | +* Separate reports that contain sensitive metrics sent to selective audiences. |
| 20 | +* Reports to stakeholders who might not have access to the portal resources. |
21 | 21 |
|
22 |
| -> [!NOTE] |
23 |
| -> The weekly Application Insights digest email did not allow any customization, and will be discontinued in favor of the custom options listed below. The last weekly digest email will be sent on June 11, 2018. Please configure one of the following options to get similar custom reports (use the query suggested below). |
| 22 | +> [!NOTE] |
| 23 | +> The weekly Application Insights digest email didn't allow any customization and will be discontinued in favor of the custom options listed here. The last weekly digest email was sent on June 11, 2018. Configure one of the following options to get similar custom reports. Use the query that's suggested in this article. |
24 | 24 |
|
25 |
| -## To automate custom report emails |
| 25 | +## Automate custom report emails |
26 | 26 |
|
27 | 27 | You can [programmatically query Application Insights](https://dev.applicationinsights.io/) data to generate custom reports on a schedule. The following options can help you get started quickly:
|
28 | 28 |
|
29 |
| -* [Automate reports with Power Automate](../logs/logicapp-flow-connector.md) |
30 |
| -* [Automate reports with Logic Apps](automate-with-logic-apps.md) |
31 |
| -* Use the "Application Insights scheduled digest" [Azure function](../../azure-functions/functions-get-started.md) template in the Monitoring scenario. This function uses SendGrid to deliver the email. |
| 29 | +* [Automate reports with Power Automate](../logs/logicapp-flow-connector.md). |
| 30 | +* [Automate reports with Azure Logic Apps](automate-with-logic-apps.md). |
| 31 | +* Use the **Application Insights scheduled digest** [Azure Functions](../../azure-functions/functions-get-started.md) template in the **Monitoring** scenario. This function uses SendGrid to deliver the email. |
32 | 32 |
|
33 |
| -  |
| 33 | +  |
34 | 34 |
|
35 | 35 | ## Sample query for a weekly digest email
|
36 |
| -The following query shows joining across multiple datasets for a weekly digest email like report. Customize it as required and use it with any of the options listed above to automate a weekly report. |
| 36 | +The following query shows joining across multiple datasets for a weekly digest email-like report. Customize it as required and use it with any of the options previously listed to automate a weekly report. |
37 | 37 |
|
38 | 38 | ```AIQL
|
39 | 39 | let period=7d;
|
@@ -65,87 +65,87 @@ availabilityResults
|
65 | 65 |
|
66 | 66 | ## Application Insights scheduled digest report
|
67 | 67 |
|
68 |
| -1. Create an Azure Function App.(Application Insights _On_ is required only if you want to monitor your new Function App with Application Insights) |
| 68 | +1. Create an Azure Functions app. Application Insights **On** is required only if you want to monitor your new Azure Functions app with Application Insights. |
69 | 69 |
|
70 |
| - Visit the Azure Functions documentation to learn how to [create a function app](../../azure-functions/functions-get-started.md) |
| 70 | + See the Azure Functions documentation to learn how to [create a function app](../../azure-functions/functions-get-started.md). |
71 | 71 |
|
72 |
| -2. Once your new Function App has completed deployment, select **Go to resource**. |
| 72 | +1. After your new Azure Functions app has finished deployment, select **Go to resource**. |
73 | 73 |
|
74 |
| -3. Select **New function**. |
| 74 | +1. Select **New function**. |
75 | 75 |
|
76 |
| -  |
| 76 | +  |
77 | 77 |
|
78 |
| -4. Select the **_Application Insights scheduled digest template_**. |
| 78 | +1. Select the **Application Insights scheduled digest** template. |
79 | 79 |
|
80 | 80 | > [!NOTE]
|
81 |
| - > By default, function apps are created with runtime version 3.x. You must [target Azure Functions runtime version](../../azure-functions/set-runtime-version.md) **1.x** to use the Application Insights scheduled digest template. Go to Configuration > Function Runtime settings to change the runtime version.  |
| 81 | + > By default, function apps are created with runtime version 3.x. You must [target Azure Functions runtime version](../../azure-functions/set-runtime-version.md) **1.x** to use the Application Insights scheduled digest template. Go to **Configuration** > **Function runtime settings** to change the runtime version.  |
82 | 82 |
|
83 |
| -  |
| 83 | +  |
84 | 84 |
|
85 |
| -5. Enter an appropriate recipient e-mail address for your report and select **Create**. |
| 85 | +1. Enter an appropriate recipient email address for your report and select **Create**. |
86 | 86 |
|
87 |
| -  |
| 87 | +  |
88 | 88 |
|
89 |
| -6. Select your **Function App** > **Platform features** > **Configuration**. |
| 89 | +1. Select **Function Apps** > **Platform features** > **Configuration**. |
90 | 90 |
|
91 |
| -  |
| 91 | +  |
92 | 92 |
|
93 |
| -7. Create three new application settings with appropriate corresponding values ``AI_APP_ID``, ``AI_APP_KEY``, and ``SendGridAPI``. Select **Save**. |
| 93 | +1. Create three new application settings with the appropriate corresponding values ``AI_APP_ID``, ``AI_APP_KEY``, and ``SendGridAPI``. Select **Save**. |
94 | 94 |
|
95 |
| -  |
| 95 | +  |
96 | 96 |
|
97 |
| - (The AI_ values can be found under API Access for the Application Insights Resource you want to report on. If you don't have an Application Insights API Key, there is the option to **Create API Key**.) |
| 97 | + You can find the AI_ values under **API Access** for the Application Insights resource you want to report on. If you don't have an Application Insights API key, use the **Create API Key** option. |
98 | 98 |
|
99 | 99 | * AI_APP_ID = Application ID
|
100 | 100 | * AI_APP_KEY = API Key
|
101 | 101 | * SendGridAPI =SendGrid API Key
|
102 | 102 |
|
103 | 103 | > [!NOTE]
|
104 |
| - > If you don't have a SendGrid account you can create one. SendGrid's documentation for Azure Functions is [here](../../azure-functions/functions-bindings-sendgrid.md). If just want a minimal explanation of how to setup SendGrid and generate an API key one is provided at the end of this article. |
| 104 | + > If you don't have a SendGrid account, you can create one. For more information, see [Azure Functions SendGrid bindings](../../azure-functions/functions-bindings-sendgrid.md) for the SendGrid documentation for Azure Functions. If you want a brief explanation of how to set up SendGrid and generate an API key, one is provided at the end of this article. |
105 | 105 |
|
106 |
| -8. Select **Integrate** and under Outputs click **SendGrid ($return)**. |
| 106 | +1. Select **Integrate**. Under **Outputs**, select **SendGrid ($return)**. |
107 | 107 |
|
108 |
| -  |
| 108 | +  |
109 | 109 |
|
110 |
| -9. Under the **SendGridAPI Key App Setting**, select your newly created App Setting for **SendGridAPI**. |
| 110 | +1. Under the **SendGridAPI Key App Setting**, select your newly created app setting **SendGridAPI**. |
111 | 111 |
|
112 |
| -  |
| 112 | +  |
113 | 113 |
|
114 |
| -10. Run and test your Function App. |
| 114 | +1. Run and test your function app. |
115 | 115 |
|
116 |
| -  |
| 116 | +  |
117 | 117 |
|
118 |
| -11. Check your e-mail to confirm that the message was sent/received successfully. |
| 118 | +1. Check your email to confirm that the message was sent or received successfully. |
119 | 119 |
|
120 |
| -  |
| 120 | +  |
121 | 121 |
|
122 | 122 | ## SendGrid with Azure
|
123 | 123 |
|
124 | 124 | These steps only apply if you don't already have a SendGrid account configured.
|
125 | 125 |
|
126 |
| -1. From the Azure portal, select **Create a resource** > search for **SendGrid Email Delivery** > click **Create** > fill out the SendGrid specific create instructions. |
| 126 | +1. On the Azure portal, select **Create a resource**. Search for **SendGrid Email Delivery** and select **Create**. Fill out the SendGrid instructions. |
127 | 127 |
|
128 |
| -  |
| 128 | +  |
129 | 129 |
|
130 |
| -2. Once created under SendGrid Accounts select **Manage**. |
| 130 | +1. Under **SendGrid Accounts**, select **Manage**. |
131 | 131 |
|
132 |
| -  |
| 132 | +  |
133 | 133 |
|
134 |
| -3. This will launch SendGrid's site. Select **Settings** > **API Keys**. |
| 134 | +1. This action opens SendGrid's site. Select **Settings** > **API Keys**. |
135 | 135 |
|
136 |
| -  |
| 136 | +  |
137 | 137 |
|
138 |
| -4. Create an API Key > choose **Create & View**. (Review SendGrid's documentation on restricted access to determine what level of permissions is appropriate for your API Key. Full Access is selected here for example purposes only.) |
| 138 | +1. To create an API key, select **Create & View**. Review SendGrid's documentation on restricted access to determine what level of permissions is appropriate for your API key. **Full Access** is selected here only as an example. |
139 | 139 |
|
140 |
| -  |
| 140 | +  |
141 | 141 |
|
142 |
| -5. Copy the entire key, this value is what you need in your Function App settings as the value for SendGridAPI |
| 142 | +1. Copy the entire key. This value is what you need in your function app settings as the value for `SendGridAPI`. |
143 | 143 |
|
144 |
| -  |
| 144 | +  |
145 | 145 |
|
146 | 146 | ## Next steps
|
147 | 147 |
|
148 | 148 | * Learn more about creating [Analytics queries](../logs/get-started-queries.md).
|
149 | 149 | * Learn more about [programmatically querying Application Insights data](https://dev.applicationinsights.io/)
|
150 | 150 | * Learn more about [Logic Apps](../../logic-apps/logic-apps-overview.md).
|
151 |
| -* Learn more about [Microsoft Power Automate](https://ms.flow.microsoft.com). |
| 151 | +* Learn more about [Power Automate](https://ms.flow.microsoft.com). |
0 commit comments