Insights on Application Insights

Wondering how to use Application Insights with your Sitecore project? Here is a quick reference on how to add it.

Application Insights is an Application Performance Management service which notably has a user interface to filter and view logged messages and is rising in popularity with Sitecore implementations. Sitecore has made an implementation available for cloud deployments that sends Sitecore logging and performance counters to Application Insights. We can borrow it for any Sitecore instance even those not hosted in the cloud.

A number of articles share the benefits of leveraging the cloud based tool, but I haven't seen any showing how to configure it. So for those not as familiar with Sitecore's Azure deployment packages here is a quick guide for how to send Sitecore's logging to Application Insights.

Prerequisites… you will need:

  • A Sitecore instance - works with any regardless of hosting (ie. doesn't need to be in the cloud)
  • A Sitecore certified account - You'll need to download the needed files.
  • An Azure subscription is required to provision the Application Insights app.
    • You can sign up with a free developer subscription for testing. You are required to enter a credit card, but not to fear, Microsoft provides a spending limit of $0 so you will not be charged if you don't want to be. A developer account is refreshed with 25 credits monthly, no charge.
  • A provisioned Applications Insights app
    • Remember there is a daily space cap for the free Application Insights… so you'll need a paid account for a production instance… or really clean logs :)

Steps to get it going:

  1. Get the goods (dlls and configs)
    1. Log in to
    2. Navigate to the download page for your version of sitecore
    3. Download a package from the "Download options for Azure AppService" section. Choose XPO (single instance), it is the smallest.
      1. These packages are typically used with Sitecore's Azure Toolkit to provision the resources and deploy a clean install of Sitecore as an Azure App, but we just be pulling a few of the files.
    4. Unzip the downloaded file
      1. Drill down to the file and unzip that too
        1. Drill down to the /Content/Website folder
  2. Copy what we need
    1. The source will be the ../Content/Website folder from the downloaded deployment package
    2. The target will be the Website folder of whichever Sitecore instance you are working with
    3. NOTE: there are a couple paths you could go here. You could either install the Application Insights nuget package in you code solution in order to get the dependency dlls and Webconfig transformations, or you can just extract what you need from the sitecore package. I opted for the latter.
    4. Identify and copy these files:
      1. /ApplicationInsights.config
      2. /App_Config/Include/zzz/Sitecore.Cloud.ApplicationInsights.config
      3. /bin/
        • Microsoft.AI.*
        • Sitecore.Cloud.ApplicationInsights.*
    5. Add this connection string to /App_Config/ConnectionStrings.config
      1. <add name="appinsights.instrumentationkey" connectionString="place-your-guid-key-here"/>
        1. The value of the connectionString is the Instrumentation Key, found under properties
    6. Add sections to the Web.config.
      NOTE: I chose to copy these areas from the Sitecore package to match that version of Application Insights instead of using the Application Insights NuGet package.

      It's worth noting there are some configs worth reviewing at the bottom of the config file "zzz/Sitecore.Cloud.ApplicationInsights.config". Performance counters are defaulted off, but can be enabled. You can also set the ApplicationInsights.Role setting with labels like "CD" or "CM" if you want to consolidate logs from several Sitecore instances into one account and filter by the instance.

      Sitecore posted documentation showing how to navigate the logs in Application Insights.

      There are many other benefits too like smart monitoring and reporting features.

    Contact Us

About Author

James Gregory
James is an NIU grad with a major in computer science, theoretical emphasis, and math minor. He's been developing websites since 2001. After gaining experience designing custom platforms, e-commerce, and automation solutions James joined in 2013, focusing on Sitecore. Twice awarded Sitecore MVP and two time winner of the annual Sitecore Hackathon he continues to help clients get the most out of their technology. When not tinkering with tech, James enjoys disc golf and a good strategy table top game with friends.

Featured Posts