Azure 生产问题诊断
azure-diagnostics
使用 AppLens、Azure Monitor、资源健康状况和安全分诊来调试 Azure 生产环境问题,包括在无实时访问权限情况下仅基于证据的诊断。WHEN:调试生产问题、排查应用服务、应用服务高 CPU、应用服务部署失败、排查容器应用、容器应用 503 或目标端口不匹配、排查函数、函数遥测丢失或在配置/连接字符串更改后停止、排查 AKS、VM RDP、Linux SSH、VM 黑屏、无法连接 VM、重置 VM 密码、NSG 或防火墙阻止、kubectl 无法连接、kube-system/CoreDNS 故障、pod pending、crashloop、节点未就绪、升级失败、分析日志、KQL、insights、镜像拉取失败、冷启动问题、健康探测失败、资源健康状况、错误根本原因、排查事件中心、排查服务总线、消息 SDK 错误、AMQP 连接失败、消息锁丢失、长时间运行处理期间的锁续订、服务总线死信。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 267
01 前言 Front Matter
- name
- azure-diagnostics
- license
- MIT
- metadata
- { "author": "Microsoft", "version": "1.2.14" }
- description
- Debug Azure production issues using AppLens, Azure Monitor, resource health, and safe triage, including evidence-only diagnosis without live access. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
02 资源文件 53
- 参考文档references/app-service/README.md7.8 KB
- 参考文档references/azure-resource-graph.md2.8 KB
- 参考文档references/container-apps/README.md3.5 KB
- 参考文档references/functions/durable.md7.6 KB
- 参考文档references/functions/README.md3.9 KB
- 参考文档references/functions/triggers.md8.3 KB
- 参考文档references/kql-queries.md1.3 KB
- 脚本scripts/aks-baseline.ps17.4 KB
- 脚本scripts/aks-baseline.sh7.0 KB
- 脚本scripts/appservice-diagnostics.ps12.7 KB
- 脚本scripts/appservice-diagnostics.sh3.3 KB
- 脚本scripts/containerapp-diagnostics.ps12.5 KB
- 脚本scripts/containerapp-diagnostics.sh3.1 KB
- 脚本scripts/pod-evidence.ps16.6 KB
- 脚本scripts/pod-evidence.sh7.1 KB
- 脚本scripts/run-ig.ps15.6 KB
- 脚本scripts/run-ig.sh6.5 KB
- 脚本scripts/test-messaging-connectivity.ps16.3 KB
- 脚本scripts/test-messaging-connectivity.sh6.8 KB
- 参考文档troubleshooting/aks/aks-troubleshooting.md9.2 KB
- 参考文档troubleshooting/aks/general-diagnostics.md2.0 KB
- 参考文档troubleshooting/aks/load-balancer-and-ingress.md3.6 KB
- 参考文档troubleshooting/aks/network-policy.md832 B
- 参考文档troubleshooting/aks/networking.md5.5 KB
- 参考文档troubleshooting/aks/node-issues.md4.7 KB
- 参考文档troubleshooting/aks/optional-aks-operations.md2.3 KB
- 参考文档troubleshooting/aks/pod-failures.md7.6 KB
- 参考文档troubleshooting/aks/references/aks-mcp.md2.3 KB
- 参考文档troubleshooting/aks/references/command-flows.md4.1 KB
- 参考文档troubleshooting/aks/references/inspektor-gadget.md7.6 KB
- 参考文档troubleshooting/aks/references/structured-input-modes.md1.5 KB
- 参考文档troubleshooting/aks/spot-and-zone-issues.md2.5 KB
- 参考文档troubleshooting/aks/upgrade-operations.md2.2 KB
- 参考文档troubleshooting/compute/references/cannot-connect-to-vm.md3.1 KB
- 参考文档troubleshooting/compute/references/credential-auth-errors.md2.3 KB
- 参考文档troubleshooting/compute/references/firewall-blocking.md2.3 KB
- 参考文档troubleshooting/compute/references/network-connectivity.md2.5 KB
- 参考文档troubleshooting/compute/references/rdp-connectivity.md2.7 KB
- 参考文档troubleshooting/compute/references/rdp-service-config.md3.2 KB
- 参考文档troubleshooting/compute/references/ssh-connectivity.md2.9 KB
- 参考文档troubleshooting/compute/references/vm-agent-not-responding.md3.6 KB
- 参考文档troubleshooting/compute/vm-troubleshooting.md3.3 KB
- 参考文档troubleshooting/messaging/auth-best-practices.md6.1 KB
- 参考文档troubleshooting/messaging/azure-eventhubs-dotnet.md3.5 KB
- 参考文档troubleshooting/messaging/azure-eventhubs-java.md3.2 KB
- 参考文档troubleshooting/messaging/azure-eventhubs-js.md2.7 KB
- 参考文档troubleshooting/messaging/azure-eventhubs-py.md4.3 KB
- 参考文档troubleshooting/messaging/azure-servicebus-dotnet.md2.5 KB
- 参考文档troubleshooting/messaging/azure-servicebus-java.md2.2 KB
- 参考文档troubleshooting/messaging/azure-servicebus-js.md2.4 KB
- 参考文档troubleshooting/messaging/azure-servicebus-py.md2.3 KB
- 参考文档troubleshooting/messaging/README.md1.6 KB
- 参考文档troubleshooting/messaging/service-troubleshooting.md5.1 KB
03 SKILL.md 正文
Azure Diagnostics
AUTHORITATIVE GUIDANCE — MANDATORY COMPLIANCE
This document is the official source for debugging and troubleshooting Azure production issues. Follow these instructions to diagnose and resolve common Azure service problems systematically.
Triggers
Activate this skill when user wants to:
- Debug or troubleshoot production issues
- Diagnose errors in Azure services
- Analyze application logs or metrics
- Fix image pull, cold start, or health probe issues
- Investigate why Azure resources are failing
- Find root cause of application errors
- Troubleshoot App Service issues (high CPU, deployment failures, crashes, slow responses, TLS/custom domains)
- Respond to prompts like "troubleshoot app service", "app service high CPU", or "app service deployment failure"
- Troubleshoot Azure Function Apps (invocation failures, timeouts, binding errors)
- Find the App Insights or Log Analytics workspace linked to a Function App
- Troubleshoot AKS clusters, nodes, pods, ingress, or Kubernetes networking issues
- Troubleshoot Azure VM connectivity issues (RDP/SSH failures, port 3389/22 timeouts, NSG or firewall blocking, credential resets)
- Troubleshoot Azure Messaging SDK issues (Event Hubs, Service Bus connection failures, AMQP errors, message lock issues)
- Root-cause a symptom that looks like a healthy-runtime-but-wrong-destination problem (e.g., telemetry/messages stop flowing to the expected resource after a config change) — invoke this skill for the matrix even when MCP tools could answer the surface question alone
Rules
- Start with systematic diagnosis flow
- Use supplied evidence first. If the user requests evidence-only analysis or prohibits live Azure access, do not query or modify Azure. Diagnose from the supplied logs, metrics, and timeline; identify assumptions and provide optional verification steps.
- Use AppLens (MCP) for AI-powered diagnostics when available
- Check resource health before deep-diving into logs
- Select appropriate troubleshooting guide based on service type
- Document findings and attempted remediation steps
- Prefer bundled diagnostic scripts over ad hoc calls for permitted live collection when identifiers are known. If supplied evidence suffices or live access is prohibited, don't run them; otherwise run the applicable script first.
- Route AKS incidents to the dedicated AKS troubleshooting document
- Keep baseline AKS diagnostics available even when the optional
aks-skillsadd-on is absent, declined, or unsupported by the host
Quick Diagnosis Flow
- Identify symptoms - What's failing?
- Check resource health - Is Azure healthy?
- Review logs - What do logs show?
- Analyze metrics - Performance patterns?
- Investigate recent changes - What changed?
Troubleshooting Guides by Service
| Service | Common Issues | Reference |
|---|---|---|
| Container Apps | Image pull failures, cold starts, health probes, port mismatches | container-apps/ |
| App Service | High CPU, deployment failures, crashes, slow responses, TLS/custom domains | app-service/ |
| Function Apps | App details, invocation failures, timeouts, binding errors, cold starts, missing app settings | functions/ |
| AKS | Cluster access, nodes, kube-system, scheduling, crash loops, ingress, DNS, upgrades |
AKS Troubleshooting |
| Compute | VM RDP/SSH connectivity, NSG/firewall blocks, credential resets, VM agent/tooling issues | VM Connectivity Troubleshooting |
| Messaging | Event Hubs & Service Bus SDK errors, AMQP failures, message lock, connectivity | Messaging Troubleshooting |
Routing
- Keep Container Apps and Function Apps diagnostics in this parent skill.
- Route active AKS incidents, AKS-specific intake, evidence gathering, and remediation guidance to AKS Troubleshooting.
- Route Azure VM RDP/SSH connectivity, NSG/firewall, credential reset, and VM agent troubleshooting to VM Connectivity Troubleshooting.
- Route Azure Messaging SDK troubleshooting (Event Hubs, Service Bus) to Messaging Troubleshooting.
Quick Reference
Common Diagnostic Commands
# Check resource health
az resource show --ids RESOURCE_ID
# View activity log
az monitor activity-log list -g RG --max-events 20
# Container Apps logs
az containerapp logs show --name APP -g RG --follow
# Function App logs (query App Insights traces)
az monitor app-insights query --apps APP-INSIGHTS -g RG \
--analytics-query "traces | where timestamp > ago(1h) | order by timestamp desc | take 50"
AppLens (MCP Tools)
For AI-powered diagnostics, use:
mcp_azure_mcp_applens
intent: "diagnose issues with <resource-name>"
command: "diagnose"
parameters:
resourceId: "<resource-id>"
Provides:
- Automated issue detection
- Root cause analysis
- Remediation recommendations
Azure Monitor (MCP Tools)
For querying logs and metrics:
mcp_azure_mcp_monitor
intent: "query logs for <resource-name>"
command: "logs_query"
parameters:
workspaceId: "<workspace-id>"
query: "<KQL-query>"
See kql-queries.md for common diagnostic queries.
Check Azure Resource Health
Using MCP
mcp_azure_mcp_resourcehealth
intent: "check health status of <resource-name>"
command: "get"
parameters:
resourceId: "<resource-id>"
Using CLI
# Check specific resource health
az resource show --ids RESOURCE_ID
# Check recent activity
az monitor activity-log list -g RG --max-events 20
References
04 同仓库更多 Skills
azure-advisor-cost-optimization
Analyze Azure Advisor Cost/IdleResources findings and prevalidate deletion safety, including Service Groups. WHEN: "find unused Azure resources", "what resources am I paying for but no longer using", "idle-resource savings", "historical idle-resource savings", "are these idle resources safe to delete". Generic Cost, other subcategories, and cross-category requests use azure-advisor.
Python应用Azure App Service部署
python-appservice-deploy
将Python(Flask/Django/FastAPI)代码部署到Azure App Service Linux。适用场景:"Flask App Service"、"Django App Service"、"FastAPI App Service"、"将Python部署到App Service"。不适用于:Container Apps、Functions、非Python、Terraform/Bicep/IaC、完整基础设施——请使用 azure-prepare。
Azure OpenAI模型最佳区域部署
preset
通过分析所有可用区域的容量,智能地将Azure OpenAI模型部署到最佳区域。自动先检查当前区域,并在必要时显示备选方案。适用于:快速部署、最佳区域、最优区域、自动区域选择、快速设置、多区域容量检查、高可用部署、部署到最佳位置。不适用于:自定义SKU选择(请使用 customize)、特定版本选择(请使用 customize)、自定义容量配置(请使用 customize)、PTU部署(请使用 customize)。
Azure OpenAI模型自定义部署
customize
Azure OpenAI模型的交互式引导部署流程,提供完全自定义控制。逐步选择模型版本、SKU(GlobalStandard/Standard/ProvisionedManaged)、容量、RAI策略(内容过滤器)以及高级选项(动态配额、优先处理、溢出)。适用于:自定义部署、自定义模型部署、选择版本、选择SKU、设置容量、配置内容过滤器、RAI策略、部署选项、详细部署、高级部署、PTU部署、预置吞吐量。不适用于:快速部署到最佳区域(请使用 preset)。
Azure OpenAI容量查询
capacity
发现跨区域和项目的可用 Azure OpenAI 模型容量。分析配额限制、比较可用性,并根据容量需求推荐最佳部署位置。USE FOR:查找容量、检查配额、可以在哪里部署、容量发现、容量最佳区域、多项目容量搜索、配额分析、模型可用性、区域比较、检查 TPM 可用性。DO NOT USE FOR:实际部署(发现后转交给预设或自定义技能)、配额提升请求(引导用户前往 Azure 门户)、列出现有部署。
Azure OpenAI模型部署
deploy-model
统一的 Azure OpenAI 模型部署技能,具备基于意图的智能路由。处理快速预设部署、完全自定义部署(版本/SKU/容量/RAI 策略)以及跨区域和项目的容量发现。USE FOR:部署模型、部署 gpt、创建部署、模型部署、部署 openai 模型、设置模型、配置模型、查找容量、检查模型可用性、可以在哪里部署、模型最佳区域、容量分析。DO NOT USE FOR:列出现有部署(使用 foundry_models_deployments_list MCP 工具)、删除部署、创建智能体(使用 agent/create)、创建项目(使用 project/create)。