$appInsights = New-AzureRmApplicationInsights -Location USEast -ResourceGroupName rgname -Name ainame
$appInsights.InstrumentationKey #copy this
dotnet new mvc
dotnet add package Microsoft.ApplicationInsights.AspNetCore
In appsettings.json, add this
{
“ApplicationInsights”: {
“InstrumentationKey”: “11111111-2222-3333-4444-555555555555"
}
}
In program.cs add UseApplicationInsights() to the method chain for CreateDefaultBuilder
dotnet run
Ref: https://github.com/Microsoft/ApplicationInsights-aspnetcore/wiki/Getting-Started-with-Application-Insights-for-ASP.NET-Core