Azure Observability Services
Query metrics, logs, and traces across Azure Monitor, Application Insights, and Log Analytics. This runbook enables an agent to access Azure Monitor metrics, Application Insights APM data, and Log Analytics KQL queries through MCP tools or Azure CLI commands…
8 steps · start to finish.
- 1Step 1
Environment Setup
▶Verify Azure CLI is installed and the user is authenticated.
echo "=== Environment Setup ===" # Verify required tools command -v az >/dev/null || { echo "ERROR: Azure CLI not installed"; exit 1; } command -v jq >/dev/null || { echo "ERROR: jq not installed"; exit 1; } # Verify Azure authentication az account show --output table || { echo "ERROR: Not logged in to Azure. Run 'az login'"; exit 1; } # Create output directory mkdir -p /app/results echo "Environment ready." echo "Subscription: $(az account show --query 'name' -o tsv)" echo "Tenant: $(az account show --query 'tenantId' -o tsv)"If Azure MCP is available: Check MCP connectivity with
azure__monitortool first. If MCP is not enabled, run/azure:setupor enable via/mcp. - 2Step 2
Discover Resources
▶List available Azure Monitor resources, Log Analytics workspaces, and Application Insights components.
- 3Step 3
Query Metrics
▶Query Azure Monitor metrics for the target resource.
- 4Step 4
Query Logs with KQL
▶Run KQL queries against Log Analytics to retrieve application logs, errors, and performance data.
- 5Step 5
Query Application Insights
▶Retrieve APM data, distributed traces, and dependency information from Application Insights.
- 6Step 6
Iterate on Errors (max 3 rounds)
▶If any queries fail, apply targeted fixes:
- 7Step 7
Generate Monitoring Report
▶Synthesize the collected observability data into a human-readable report.
- 8Step 8
Final Checklist (MANDATORY — do not skip)
▶echo "=== FINAL OUTPUT VERIFICATION ===" RESULTS_DIR="/app/results" for f in \ "$RESULTS_DIR/summary.md" \