You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/configure-monitoring.md
+15-10Lines changed: 15 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Configure monitoring for Azure Functions
3
3
description: Learn how to connect your function app to Application Insights for monitoring and how to configure data collection.
4
4
ms.service: azure-functions
5
5
ms.topic: how-to
6
-
ms.date: 07/11/2024
6
+
ms.date: 08/06/2024
7
7
ms.custom: devdivchpfy22
8
8
9
9
# Customer intent: As a developer, I want to understand how to configure monitoring for my functions correctly, so I can collect the data that I need.
@@ -48,7 +48,7 @@ Category names are assigned differently in Functions compared to other .NET fram
48
48
49
49
The following table describes the main categories of logs that the runtime creates:
50
50
51
-
# [v2.x+](#tab/v2)
51
+
###[v2.x+](#tab/v2)
52
52
53
53
| Category | Table | Description |
54
54
| ----- | ----- | ----- |
@@ -65,7 +65,7 @@ The following table describes the main categories of logs that the runtime creat
65
65
> [!NOTE]
66
66
> For .NET class library functions, these categories assume you're using `ILogger` and not `ILogger<T>`. For more information, see the [Functions ILogger documentation](functions-dotnet-class-library.md#ilogger).
67
67
68
-
# [v1.x](#tab/v1)
68
+
###[v1.x](#tab/v1)
69
69
70
70
| Category | Table | Description |
71
71
| ----- | ----- | ----- |
@@ -90,7 +90,7 @@ The following examples define logging based on the following rules:
90
90
+`Host.Aggregator` and `Host.Results` are set to lower levels. Setting logging levels too high (especially higher than `Information`) can result in loss of metrics and performance data.
91
91
+ Logging for function runs is set to `Information`. If necessary, you can [override](functions-host-json.md#override-hostjson-values) this setting in local development to `Debug` or `Trace`.
92
92
93
-
# [v2.x+](#tab/v2)
93
+
###[v2.x+](#tab/v2)
94
94
95
95
```json
96
96
{
@@ -106,7 +106,7 @@ The following examples define logging based on the following rules:
106
106
}
107
107
```
108
108
109
-
# [v1.x](#tab/v1)
109
+
###[v1.x](#tab/v1)
110
110
111
111
```json
112
112
{
@@ -127,7 +127,7 @@ The following examples define logging based on the following rules:
127
127
128
128
If *[host.json]* includes multiple logs that start with the same string, the more defined logs ones are matched first. Consider the following example that logs everything in the runtime, except `Host.Aggregator`, at the `Error` level:
129
129
130
-
# [v2.x+](#tab/v2)
130
+
###[v2.x+](#tab/v2)
131
131
132
132
```json
133
133
{
@@ -143,7 +143,7 @@ If *[host.json]* includes multiple logs that start with the same string, the mor
143
143
}
144
144
```
145
145
146
-
# [v1.x](#tab/v1)
146
+
###[v1.x](#tab/v1)
147
147
148
148
```json
149
149
{
@@ -191,7 +191,7 @@ As noted in the previous section, the runtime aggregates data about function exe
191
191
192
192
Application Insights has a [sampling](../azure-monitor/app/sampling.md) feature that can protect you from producing too much telemetry data on completed executions at times of peak load. When the rate of incoming executions exceeds a specified threshold, Application Insights starts to randomly ignore some of the incoming executions. The default setting for maximum number of executions per second is 20 (five in version 1.x). You can configure sampling in [*host.json*](./functions-host-json.md#applicationinsights). Here's an example:
193
193
194
-
# [v2.x+](#tab/v2)
194
+
###[v2.x+](#tab/v2)
195
195
196
196
```json
197
197
{
@@ -209,7 +209,7 @@ Application Insights has a [sampling](../azure-monitor/app/sampling.md) feature
209
209
210
210
You can exclude certain types of telemetry from sampling. In this example, data of type `Request` and `Exception` is excluded from sampling. It ensures that *all* function executions (requests) and exceptions are logged while other types of telemetry remain subject to sampling.
211
211
212
-
# [v1.x](#tab/v1)
212
+
###[v1.x](#tab/v1)
213
213
214
214
```json
215
215
{
@@ -288,11 +288,16 @@ For a function app to send data to Application Insights, it needs to connect to
288
288
| Setting name | Description |
289
289
| ---- | ---- |
290
290
|**[`APPLICATIONINSIGHTS_CONNECTION_STRING`](functions-app-settings.md#applicationinsights_connection_string)**| This setting is recommended and is required when your Application Insights instance runs in a sovereign cloud. The connection string supports other [new capabilities](../azure-monitor/app/migrate-from-instrumentation-keys-to-connection-strings.md#new-capabilities). |
291
-
|**[`APPLICATIONINSIGHTS_AUTHENTICATION_STRING`](./functions-app-settings.md#applicationinsights_authentication_string)**| Connects to Application Insights using Microsoft Entra authentication. The value contains the client ID of either a system-assigned or a user-assigned managed identity that is authorized to publish telemetry to your Application Insights workspace. The string has a format of `ClientId=<YOUR_CLIENT_ID>;Authorization=AAD`. For more information, see [Microsoft Entra authentication for Application Insights](../azure-monitor/app/azure-ad-authentication.md).|
292
291
|**[`APPINSIGHTS_INSTRUMENTATIONKEY`](functions-app-settings.md#appinsights_instrumentationkey)**| Legacy setting, which Application Insights has deprecated in favor of the connection string setting. |
293
292
294
293
When you create your function app in the [Azure portal](./functions-get-started.md) from the command line by using [Azure Functions Core Tools](./create-first-function-cli-csharp.md) or [Visual Studio Code](./create-first-function-vs-code-csharp.md), Application Insights integration is enabled by default. The Application Insights resource has the same name as your function app, and is created either in the same region or in the nearest region.
295
294
295
+
### Require Microsoft Entra authentication
296
+
297
+
You can use tbe [`APPLICATIONINSIGHTS_AUTHENTICATION_STRING`](./functions-app-settings.md#applicationinsights_authentication_string) setting to enable connections to Application Insights using Microsoft Entra authentication. The value contains either `Authorization=AAD` for a system-assigned managed identity or `ClientId=<YOUR_CLIENT_ID>;Authorization=AAD` for a user-assigned managed identity. The managed identity must already be available to the function app, with an assigned role equivalent to [Monitoring Metrics Publisher](/azure/role-based-access-control/built-in-roles/monitor#monitoring-metrics-publisher). For more information, see [Microsoft Entra authentication for Application Insights](../azure-monitor/app/azure-ad-authentication.md).|
298
+
299
+
The [`APPLICATIONINSIGHTS_CONNECTION_STRING`](functions-app-settings.md#applicationinsights_connection_string) setting is still required.
0 commit comments