Setting your Application Insights Connection String

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.

This surprised me! Where did these custom event’s come from? Oh, “Sitecore Identity”…

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.

Setting your Application Insights Connection String

2 thoughts on “Setting your Application Insights Connection String

  1. Marc's avatar Marc says:

    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?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.