Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I need both APPINSIGHTS_INSTRUMENTATIONKEY and APPLICATIONINSIGHTS_CONNECTION_STRING in my Azure Function configuration?

Tags:

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.

like image 528
Niels Brinch Avatar asked Mar 15 '20 09:03

Niels Brinch


People also ask

What is Appinsights_instrumentationkey?

APPINSIGHTS_INSTRUMENTATIONKEY is azure way of passing the key. ASP.NET Core syntax would only apply to ASP.NET Core apps, not to other kind of apps hosted on Azure. – Tseng.

Which of the following are tools could be helpful in monitoring the Azure functions?

Azure Functions can be monitored using Application Insights and Azure Monitor. Though Azure provides such monitoring solutions, users cannot monitor multiple entities with various metrics. Whereas, with Serverless360 monitoring, it is possible to monitor various entities based on metrics at the Application level.

Is application Insights connection string a secret?

Is Connection string a secret? Connection string contains iKey which is a unique identifier used by the ingestion service to associate telemetry to a specific Application Insights resource. It is not to be considered a security token or key.

How do I enable application Insights in Azure function app?

In your function app, select Configuration under Settings, and then select Application settings. If you see a setting named APPINSIGHTS_INSTRUMENTATIONKEY , Application Insights integration is enabled for your function app running in Azure.


2 Answers

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.

like image 69
Gaurav Mantri Avatar answered Sep 23 '22 20:09

Gaurav Mantri


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.

like image 28
Björn Jarisch Avatar answered Sep 24 '22 20:09

Björn Jarisch