If you’re adding Application Insights to your solution, you will need to specify a connection string. Usually, this is at the bottom of your applicationinsights.config file:

A nifty alternative is you can specify this connection as an Environment Variable – and App Insights will pick that up and use it…

However, if you do, ALL services that might use App Insights will use that Environment variable. This includes Sitecore’s IdentityServer, apparently, so don’t be surprised if you suddenly start seeing telemetry from IdentityServer in your logs.

It also applies to other sitecore instances on your machine, so you might get telemetry from the other instances too!
Despite this, setting the connection through environment variables is really useful for with containers.
Thanks Andy – just what we are looking for. To take advantage of the Environment variable approach, should we omit the ConnectionString tag altogether in the ApplicationInsights.config? Or leave some placeholder value inside it?
I think I just omitted it.