Azure 诊断
权威指导 — 强制合规
本文档是调试和排查 Azure 生产问题的官方来源。遵循这些说明,系统性地诊断并解决常见 Azure 服务问题。
触发条件
当用户希望执行以下操作时激活此技能:
- 调试或排查生产问题
- 诊断 Azure 服务中的错误
- 分析应用日志或指标
- 修复镜像拉取、冷启动或健康探测问题
- 调查 Azure 资源为何失败
- 查找应用错误的根本原因
- 排查 App Service 问题(CPU 过高、部署失败、崩溃、响应缓慢、TLS/自定义域名)
- 响应用户提示,如“排查 App Service”、“App Service CPU 过高”或“App Service 部署失败”
- 排查 Azure Function Apps(调用失败、超时、绑定错误)
- 查找与 Function App 关联的 App Insights 或 Log Analytics 工作区
- 排查 AKS 集群、节点、pod、Ingress 或 Kubernetes 网络问题
- 排查 Azure VM 连接问题(RDP/SSH 失败、端口 3389/22 超时、NSG 或防火墙阻止、凭据重置)
- 排查 Azure Messaging SDK 问题(Event Hubs、Service Bus 连接失败、AMQP 错误、消息锁问题)
规则
- 从系统化诊断流程开始
- 在可用时使用 AppLens(MCP)进行 AI 驱动诊断
- 在深入分析日志之前检查资源健康状况
- 根据服务类型选择适当的故障排查指南
- 记录发现结果和已尝试的修复步骤
- 将 AKS 事件路由到专用 AKS 故障排查文档
---
快速诊断流程
- 识别症状 - 什么失败了?
- 检查资源健康状况 - Azure 是否健康?
- 查看日志 - 日志显示什么?
- 分析指标 - 性能模式?
- 调查近期变更 - 发生了什么变化?
---
按服务划分的故障排查指南
| 服务 | 常见问题 | 参考 | |---------|---------------|-----------| | Container Apps | 镜像拉取失败、冷启动、健康探测、端口不匹配 | [container-apps/](references/container-apps/README.md) | | App Service | CPU 过高、部署失败、崩溃、响应缓慢、TLS/自定义域名 | [app-service/](references/app-service/README.md) | | Function Apps | 应用详情、调用失败、超时、绑定错误、冷启动、缺少应用设置 | [functions/](references/functions/README.md) | | AKS | 集群访问、节点、kube-system、调度、崩溃循环、Ingress、DNS、升级 | [AKS 故障排查](troubleshooting/aks/aks-troubleshooting.md) | | Compute | VM RDP/SSH 连接、NSG/防火墙阻止、凭据重置、VM 代理/工具问题 | [VM 连接故障排查](troubleshooting/compute/vm-troubleshooting.md) | | Messaging | Event Hubs 和 Service Bus SDK 错误、AMQP 失败、消息锁、连接 | [消息故障排查](troubleshooting/messaging/README.md) |
---
路由
- 将 Container Apps 和 Function Apps 诊断保留在此父技能中。
- 将活跃 AKS 事件、AKS 专用接收、证据收集和修复指导路由到 [AKS 故障排查](troubleshooting/aks/aks-troubleshooting.md)。
- 将 Azure VM RDP/SSH 连接、NSG/防火墙、凭据重置和 VM 代理故障排查路由到 [VM 连接故障排查](troubleshooting/compute/vm-troubleshooting.md)。
- 将 Azure Messaging SDK 故障排查(Event Hubs、Service Bus)路由到 [消息故障排查](troubleshooting/messaging/README.md)。
---
快速参考
常用诊断命令
# 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 工具)
对于 AI 驱动诊断,使用:
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 工具)
用于查询日志和指标:
mcp_azure_mcp_monitor
intent: "query logs for <resource-name>"
command: "logs_query"
parameters:
workspaceId: "<workspace-id>"
query: "<KQL-query>"
有关常用诊断查询,请参阅 [kql-queries.md](references/kql-queries.md)。
---
检查 Azure 资源健康状况
使用 MCP
mcp_azure_mcp_resourcehealth
intent: "check health status of <resource-name>"
command: "get"
parameters:
resourceId: "<resource-id>"
使用 CLI
# Check specific resource health
az resource show --ids RESOURCE_ID
# Check recent activity
az monitor activity-log list -g RG --max-events 20
---
参考
- [KQL 查询库](references/kql-queries.md)
- [Azure Resource Graph 查询](references/azure-resource-graph.md)
- [App Service 故障排查](references/app-service/README.md)
- [Function Apps 故障排查](references/functions/README.md)
- [VM 连接故障排查](troubleshooting/compute/vm-troubleshooting.md)
- [消息故障排查](troubleshooting/messaging/README.md)