Skip to Content
Hands-On Azure for Developers
book

Hands-On Azure for Developers

by Kamil Mrzygłód
November 2018
Intermediate to advanced
606 pages
15h 7m
English
Packt Publishing
Content preview from Hands-On Azure for Developers

.NET

In .NET applications, the only thing you have to do to get started is to install the latest Microsoft.ApplicationInsights package. The easiest way is to use the following code snippet:

TelemetryConfiguration.Active.InstrumentationKey = "<instrumentation-key>";var telemetryClient = new TelemetryClient();

This code does two things:

  • Sets the current configuration by providing an instrumentation key. It is all that is needed to connect to a service.
  • Initializes an instance of TelemetryClient—this class is a proxy to a service, which enables you to communicate with it.

Then you can use different methods to log some data:

telemetryClient.TrackTrace("Hello World!");telemetryClient.TrackException(new Exception());telemetryClient.TrackDependency(new ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementing Azure: Putting Modern DevOps to Use

Implementing Azure: Putting Modern DevOps to Use

Florian Klaffenbach, Oliver Michalski, Markus Klein, Mohamed Wali

Publisher Resources

ISBN: 9781789340624Supplemental Content