AZ-204 Practice Question: Monitor, troubleshoot, and optimize Azure solutions
You are monitoring an ASP.NET Core web API with Application Insights. You want to view the SQL queries being executed, including the command text and duration, in the Application Insights portal. Which actions must you take? (Select all that apply.) (Choose 2.)
⚠ Common exam trap
Many candidates assume installing the dependency collector alone is sufficient to see SQL command text, but they overlook the explicit configuration flag (`EnableSqlCommandTextInstrumentation`) required to enable that specific data collection.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Install the `Microsoft.ApplicationInsights.DependencyCollector` NuGet package.
The `Microsoft.ApplicationInsights.DependencyCollector` NuGet package is required to automatically collect dependency telemetry, including SQL Server calls. Without this package, Application Insights will not capture SQL dependency data at all. Option C is correct because even with the dependency collector installed, SQL command text is not collected by default for security reasons; you must explicitly set `EnableSqlCommandTextInstrumentation` to `true` in the `DependencyTrackingTelemetryModule` configuration to view the actual SQL queries and their duration in the portal.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Install the `Microsoft.ApplicationInsights.Profiler.AspNetCore` NuGet package.
Why it's wrong here
Installing Microsoft.ApplicationInsights.Profiler.AspNetCore enables the Application Insights Profiler, which is designed for deep performance analysis and identifying hot paths in your application's code. While it can visualize SQL calls within its detailed trace views and call stacks, it does not automatically collect the actual SQL command text as part of standard dependency telemetry visible in the Application Insights portal's 'Dependencies' blade. Its primary role is performance diagnostics, not comprehensive dependency data collection.
- ✓
Install the `Microsoft.ApplicationInsights.DependencyCollector` NuGet package.
Why this is correct
The Microsoft.ApplicationInsights.DependencyCollector NuGet package is the foundational component for automatically tracking outgoing calls from your application to external services, including databases, HTTP services, and message queues. This package instruments common database clients to record dependency telemetry, such as the operation name, duration, and success status for SQL calls. While it collects the fact that a SQL dependency occurred, by default, it does not capture the full SQL command text itself without further configuration.
- ✓
Set `EnableSqlCommandTextInstrumentation` to `true` in the `DependencyTrackingTelemetryModule` configuration.
Why this is correct
Setting EnableSqlCommandTextInstrumentation to true within the DependencyTrackingTelemetryModule configuration explicitly instructs the Application Insights dependency collector to capture the full SQL command text for each database call. This crucial configuration allows developers to view the exact SQL queries executed in the Application Insights portal, which is invaluable for debugging performance issues, understanding data access patterns, and troubleshooting specific database interactions. This setting works in conjunction with the DependencyCollector package.
- ✗
Enable adaptive sampling to ensure all SQL queries are collected.
Why it's wrong here
Enabling adaptive sampling in Application Insights is a mechanism to reduce the volume of telemetry data sent, primarily to control ingestion costs and manage data processing load. It intelligently samples telemetry items, meaning it might drop a percentage of requests, dependencies, or traces. Therefore, enabling adaptive sampling would actually reduce the number of SQL queries collected, rather than ensuring all of them are collected or enabling the collection of specific data like command text. It is counterproductive to the goal of comprehensive data collection.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AZ-204 question from scratch — 881 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.