AZ-204 Developing Solutions for Microsoft Azure Exam

You can develop, but can you develop for the cloud? Harness your development skills and learn how to create robust solutions for Microsoft Azure, aiming for your Microsoft Certified: Azure Developer Associate certification!

Practice Test

Exam

Instrument an app or service to use Application Insights

Implement Instrumentation in an Application

Application Insights is a monitoring service that helps you track the health and performance of your applications. By adding instrumentation, you collect telemetry data such as request rates, error rates, and response times. This data gives you real-time visibility into how your app behaves in Azure, so you can troubleshoot issues and optimize performance. Implementing instrumentation early in development ensures you have insights from the moment your app runs in production.

To get started, install the Application Insights SDK in your project and configure it with a connection string or instrumentation key. Enabling automatic instrumentation lets the SDK gather common signals without extra code. By default, the SDK collects:

  • Requests
  • Dependencies
  • Exceptions
  • Performance counters These modules provide basic monitoring right away, helping you spot issues quickly.

For deeper analysis, use TelemetryClient to add custom telemetry calls in your code. You can track specific events with TrackEvent, measure values with TrackMetric, or wrap code with StartOperation<RequestTelemetry>. Attach properties or metrics to these calls to add context about user actions or business logic. Custom telemetry lets you drill down on features, monitor user behavior, and detect unusual patterns in your application.

Once your instrumentation is in place, verify it by viewing Live Metrics in the Azure portal. Live Metrics shows real-time data so you can confirm your app is sending telemetry as expected. For deeper queries, use Log Analytics to filter and explore logs. If you don’t see the data you expect, check your SDK setup, developer mode, or sampling settings to ensure nothing is being dropped. This verification step helps you confirm that your monitoring is working correctly.

Conclusion

Instrumenting your application with Application Insights involves configuring the SDK, enabling automatic data collection, and adding custom telemetry where needed. You then use Live Metrics and Log Analytics to verify that your app is sending the right information. Together, these steps ensure you have a complete view of your app’s health and performance, making it easier to maintain and improve your Azure services.