Connecting Azure Bot Services with an existing Application Insights

By | July 3, 2018

Connecting Azure Bots with Application Insights is very important to get your Bot telemetry data, as well as Bot analytics information. When we create a bot using Azure Bot Services, it creates the Application Insights resources and linked with Azure Bot. So, as soon as you run your chatbot, it starts capturing telemetry data. So far everything is fine. Now, let’s consider you have an existing Application Insight resource. Rather create a new Application Insight,  you want to link with your existing one. Well, you can achieve that by following few steps.

Connecting Azure Bots with Application Insights

When we talk about connecting Azure Bot Services with Application Insights, we need to consider it for two purposes.

  1. Application Insights capture the telemetry data of our Bot, which we will be used for instrumentation and troubleshooting purpose.
  2. Azure Bot Analytics reads instrumented data from Application Insights and displays in the Analytics blade.

 

Connecting Azure Bot Services with an existing Application Insights - Overview

 

To start capturing the telemetry data, you only need the instrumentation key of the Application Insight.

First, from Application Insights – Get the Application Insights Instrumentation Key

Related Post : 

Once you have the Instrumentation Key, Open the Azure Bot Services > Navigate to Bot Management > Settings and under the Analytics section update the Application insights Instrumentation Keys.

Connecting Azure Bot Services with an existing Application Insights

With that, your bot telemetry would be captured and collected by Application Insights. You can leverage the Application Insight dashboard for analysis of the telemetry data.

Connecting Azure Bots with Application Insights – API Keys

To address the second purpose, We need to get hold of API Keys and the Application Insights Application ID

You can query Application Insights telemetry data using Rest API and Azure Bot Analytics similar access your Application Insight information for providing the Bot Analytics. To get access to Application Insight data, you need Application ID and API Key. To get those details, Open the respective Application Insights dashboard from the Azure Portal.  Select the API Access available under Configure option.

Query Application Insights Telemetry Data using REST API - API Access

get the  Application ID from the API Access window.  Get the Application ID from here and click in “Create API Key” Option.

Query Application Insights Telemetry Data using REST API - Application ID

In the Create API Key window, provide a description of your API Keys, and choose the purpose of the API Access-like ReadWrite etc.

Once done, select the “Generate Key”.

Query Application Insights Telemetry Data using REST API - Generate API Key

Once the key is generated. Keep the API key for further reference.

Query Application Insights Telemetry Data using REST API - Get Keys

That’s it from here. Now you have the reference of Application ID and API Key, which will allow you to connect with your Application Insight Telemetry records.

Now go back to Azure Bot Service once again, BOT Management > Settings and update the Application Insight API Key and Application ID.

Connecting Azure Bot Services with an existing Application Insights

With these two values updates, the Bot Analytics would be able to populate the analytics in the dashboard.  You can see the Bot Analytics from Bot Management > Analytics page.

Bot Analytics AI

Leave a Reply