How does one add Azure Application Insights to a .NET Core App? I want to see search traffic analytics.

- 29,542
- 12
- 100
- 122

- 107
- 1
- 8
-
Is this a .net core console app or .net core web app? – Ivan Glasenberg May 27 '20 at 00:49
3 Answers
An overall solution that would work locally, on both Windows and on Linux* environments, is:
Create an Application Insights account.
Install the
Microsoft.ApplicationInsights.AspNetCore
NuGet packageUsing Dependency Injection, register the Application Insights client into the service collection. You can find a very good example on how to do this on Andrew Lock's blog.
Register Application Insights telemetry insight your
Startup
class. It will work out of the box for you later on.services.AddApplicationInsightsTelemetry();
Add
ApplicationInsights
in yourappsettings
file, andInstrumentationKey
inside of it (Your instrumentation key can be found in the overview tab of your resource):"ApplicationInsights": { "InstrumentationKey": "…" },
Now, if you run your application, you will be able to capture all traffic in your Application Insights account.
* On Linux, this is currently in preview on Azure, but this would work.

- 7,102
- 69
- 48
- 77

- 2,153
- 1
- 7
- 19
It's the same way you do for ASP.NET app. Did you have a chance to look at Start Monitoring Your ASP.NET Core Web Application which includes the same steps
- Create AppInsights
- Enable AppInsights
- Configure App Insights SDK

- 216,225
- 63
- 350
- 396
-
Thank you for your response. I've updated my Visual Studios but I do not see nor have the option to add Application Insights Telemetry to my project, this is the part I'm getting stuck at. – Nantourakis May 26 '20 at 16:26
Open your project in Visual Studio, right click in project you want to add the Application insights and click Publish. Go to Connected Services, inside Service Dependencies, click Add Dependency and select Application Insights Sdk (Local) as shown in the screenshot below.
Click Next then click Finish to install the required Nuget packages and you're done.

- 515
- 1
- 8
- 12