All the information that I can find on Application Insights seems to be targeted at websites / windows store / phone apps. I would like to monitor an Azure webjob, with the first step being able to monitor a command line app. What do I need to do in order to make this work?
Open your project in Visual Studio. Go to Project > Add Application Insights Telemetry. Choose Azure Application Insights, then select Next. Choose your subscription and Application Insights instance (or create a new instance with Create new), then select Next.
Select Application Insights in the left pane for your app service. Then select Enable. Create a new resource or select an existing Application Insights resource for this application. When you select OK to create a new resource, you're prompted to Apply monitoring settings.
Run your web app in local debug mode by using F5. Open different pages to generate some telemetry. In Visual Studio, you see a count of the events that have been logged by the Application Insights module in your project. Click this button to search your telemetry.
To use Application Insights in a Console application,
Create a new Application Insights resource as described here.
Use the NuGet package manager reference the Microsoft.ApplicationInsights
package in your console application.
In the beginning of Program.Main
, configure Application Insights to use the instrumentation key of your resource.
TelemetryConfiguration.Active.InstrumentationKey = "your key";
TelemetryClient
in the application code and call relevant Track
methods as described here.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With