Reputation: 3612
APPINSIGHTS_INSTRUMENTATIONKEY
contains the instrumentation key for Application Insights.
APPLICATIONINSIGHTS_CONNECTION_STRING
contains the instrumentation key for Application Insights prefixed with InstrumentationKey=
.
That seems pointless unless each value enables certain features with Application Insights.
Upvotes: 35
Views: 27647
Reputation: 3454
You'll only need to set the application insights connection string. Either in your appsettings.json
{
"ApplicationInsights": {
"ConnectionString" : "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://{region}.in.applicationinsights.azure.com/;LiveEndpoint=https://{region}.livediagnostics.monitor.azure.com/"
}
}
Or as an environment parameter. In Azure under settings-> configuration -> application settings:
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "InstrumentationKey=xxxxxx-xxxx-xxxx-xxxx-xxxxx;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/",
"slotSetting": true
},
Upvotes: 1
Reputation: 40603
APPINSIGHTS_INSTRUMENTATIONKEY
is deprecated:
On March 31, 2025, support for instrumentation key ingestion will end. Instrumentation key ingestion will continue to work, but we'll no longer provide updates or support for the feature. Transition to connection strings to take advantage of new capabilities.
And if you use APPINSIGHTS_INSTRUMENTATIONKEY
you should migrate to APPLICATIONINSIGHTS_CONNECTION_STRING
.
This means that we need just APPLICATIONINSIGHTS_CONNECTION_STRING
.
Upvotes: 6
Reputation: 346
One important thing to note is that if APPINSIGHTS_INSTRUMENTATIONKEY is removed from the Azure Function's configuration, the "Logs" entry in the "Monitoring" section in the Azure portal does not show logs anymore and instead asks you again to connect to an Application Insights resource. If you do so, the portal recreates the APPINSIGHTS_INSTRUMENTATIONKEY config setting.
This seems like a bug in the Azure portal since metrics and logs do continue to be collected. Also, funny enough "Log stream" continues to work as well.
Upvotes: 8
Reputation: 136196
Looking at the release notes for SDK Version 2.0.12998
:
App Insights configuration will use the APPLICATIONINSIGHTS_CONNECTION_STRING app setting if it is set (APPINSIGHTS_INSTRUMENTATIONKEY is the fallback and continues to work as-is).
Furthermore, if you read the documentation for App Insights Connection String
, you will notice that when you use connection string, you can specify custom endpoints. This is not possible if you just specify the instrumentation key. In that case, SDK will connect to default endpoints.
Upvotes: 28