Domain 4: Secure, Monitor, and Troubleshoot Azure Solutions
This lesson covers 4 exam topics: Key Vault Secrets: Retrieval and Rotation, Azure App Configuration and Feature Flags, Distributed Tracing with OpenTelemetry, KQL Queries for Logs and Metrics. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.
1. Key Vault Secrets: Retrieval and Rotation
Central question: How do apps get secrets safely and rotate them?
Facts
- Secrets are strings up to 25 KB, versioned; attributes include exp (expiration), nbf (activation) and contentType; operations include list versions, delete, purge.
- Retrieve with the SDK (
SecretClient(vault_url, DefaultAzureCredential())) or via Key Vault references in App Service/Functions; RBAC role Key Vault Secrets User for reading. - Best practice: use managed identity instead of secrets where possible; rotate the rest regularly.
- Rotation pattern: Key Vault publishes SecretNearExpiry to Event Grid 30 days before expiration → Event Grid calls a Function → function generates a new credential, creates a new secret version, updates the target service.
- References without a version pick up the latest version (App Service refetches every 24 h).
Exam traps
- Pinning a secret version in references, blocking rotation.
- Secrets in app settings or code.
- Manual rotation calendars when Event Grid automation fits.
2. Azure App Configuration and Feature Flags
Central question: How do you centralize settings and change behavior without redeploying?
Facts
- App Configuration centrally manages key-values and feature flags; providers for .NET, Java Spring, JavaScript, Python, Go.
- Keys are often hierarchical (
App:Search:TopK); labels differentiate values with the same key (e.g. dev/prod); combined key-value limit 10 KB. - Key Vault references: App Configuration stores a reference, not the secret; the app's identity reads the secret from Key Vault.
- Dynamic refresh: the provider refreshes configuration at runtime (e.g.
ConfigureRefreshwith a sentinel key or RegisterAll). - Feature flags: Switch (on/off), Rollout (percentage, targeting), Experiment (variants measured).
Exam traps
- Storing secrets as plain App Configuration values. Use Key Vault references.
- Redeploying to toggle a feature. Use a feature flag.
- Separate stores per environment when labels work.
3. Distributed Tracing with OpenTelemetry
Central question: How do you follow one request across services?
Facts
- Azure Monitor collects traces, metrics and logs via OpenTelemetry distros: the Azure Monitor OpenTelemetry Distro (e.g.
configure_azure_monitor()) and the newer Microsoft OpenTelemetry Distro (pip install microsoft-opentelemetry,use_microsoft_opentelemetry()); don't initialize both. - Connection via APPLICATIONINSIGHTS_CONNECTION_STRING; initialize before handling work.
- Built-in instrumentation for common libraries; sampling on by default (5 requests/second).
- Data lands in Application Insights tables such as AppRequests, AppDependencies, AppTraces, AppExceptions.
Concepts (general background)
A trace is a tree of spans; context propagates across services through the W3C traceparent header, so one operation ID links API → queue → worker → database. Add custom spans and attributes for business steps.
Exam traps
- Initializing two distros.
- Losing context across queues (propagate trace context in message properties).
- Assuming 100% of telemetry is kept with default sampling.
4. KQL Queries for Logs and Metrics
Central question: How do you query logs to find problems?
Facts
- Azure Monitor Logs uses Kusto Query Language (KQL); write and test queries in Log Analytics; queries also power alerts, workbooks and the query API.
- Common operators: take, where, project, summarize ... by, sort/top, extend, render.
Patterns (general background)
1AppRequests2| where TimeGenerated > ago(1h) and Success == false3| summarize failures = count() by Name, bin(TimeGenerated, 5m)4| render timechart- Latency percentiles:
summarize percentile(DurationMs, 95) by Name. - Correlate a request with dependencies by OperationId.
- Container logs:
ContainerAppConsoleLogs_CL,ContainerLogV2.
Exam traps
- where after summarize on raw columns that no longer exist.
- Averages instead of percentiles for latency.
- No time filter, scanning everything.
References
- AI-200 study guide — checked Oct 22, 2026
- About secrets — checked Oct 22, 2026
- Rotation tutorial — checked Oct 22, 2026
- Key Vault references — checked Oct 22, 2026
- What is App Configuration? — checked Oct 22, 2026
- Keys and values — checked Oct 22, 2026
- Feature management — checked Oct 22, 2026
- Enable OpenTelemetry — checked Oct 22, 2026
- Workspace-based tables — checked Oct 22, 2026
- Log queries overview — checked Oct 22, 2026
- Learn common KQL operators — checked Oct 22, 2026
Check your understanding
Event that triggers rotation?Show answerHide answer
Answer
SecretNearExpiry (30 days before).Same key, different value per environment?Show answerHide answer
Answer
Labels.Setting that tells the distro where to send data?Show answerHide answer
Answer
APPLICATIONINSIGHTS_CONNECTION_STRING.Count by time buckets?Show answerHide answer
Answer
summarize count() by bin(TimeGenerated, 5m).Role to read secrets?Show answerHide answer
Answer
Key Vault Secrets User.