1: Application Insights setup: create a new or use an existing Application Insights resource, and then get the Instrumentation key as described here.
Note: Application Insights packages and their dependencies are often updated to new versions, so I do this check to help verify that I’m not breaking dependencies in subsequent steps.
3: Using the Function App’s Kudu console ( https://
{
“frameworks”: {
“net46”:{
“dependencies”: {
“Microsoft.ApplicationInsights”: “2.3.0”,
“Microsoft.ApplicationInsights.Agent.Intercept”: “2.0.7”,
“Microsoft.ApplicationInsights.DependencyCollector”: “2.3.0”,
“Microsoft.ApplicationInsights.PerfCounterCollector”: “2.3.0”,
“Microsoft.ApplicationInsights.WindowsServer”: “2.3.0”,
“Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel”: “2.3.0”,
}
}
}
}
4: After you compile the Function (ie, run the Function), check to verify that the dependencies are listed under D:homedataFunctionspackagesnuget
5. Add the following references to the Function code file that you need to capture the AI telemetry on:
using Microsoft.ApplicationInsights.WindowsServer;
6. In your code file, instantiate a TelemetryClient
int i = 1/zero;
}
catch (Exception ex)
{
telemetryClient.TrackException(ex, new System.Collections.Generic.Dictionary
}
This post first appeared on MSDN Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The MSDN Blogs., please read the originial post: here