| name | azure-troubleshooting |
| description | Debug and troubleshoot production Azure infrastructure issues in the Agent Operating System. Covers systematic diagnostics, log analysis with KQL, resource health checks, and resolution of deployment failures, performance problems, and connectivity issues.
USE FOR: debug Azure issues, troubleshoot deployment failures, analyze logs with KQL, fix connectivity issues, resolve resource provisioning errors, investigate health probe failures, check resource health, view application logs, find root cause of errors, diagnose AOS Function App issues, fix Service Bus connection failures, resolve Key Vault access problems.
DO NOT USE FOR: deploying infrastructure (use deployment-error-fixer), creating new resources (use azure-prepare), setting up monitoring alerts (use azure-observability), cost analysis (use azure-cost-optimization).
|
| license | MIT |
| metadata | {"author":"ASISaga","version":"2.0","category":"azure-infrastructure","role":"troubleshooting-specialist"} |
| allowed-tools | Bash(az:*) Bash(gh:*) Read |
Azure Troubleshooting Skill
Description
Expert skill for diagnosing and resolving Azure infrastructure issues in the Agent Operating System (AOS). This skill provides systematic troubleshooting procedures, common error patterns, MCP tool integrations, and resolution strategies for the most frequent issues encountered in Azure deployments.
Triggers
Activate this skill when user wants to:
- Debug or troubleshoot production issues
- Diagnose errors in Azure services
- Analyze application logs or metrics with KQL
- Fix image pull, cold start, or health probe issues
- Investigate why Azure resources are failing
- Find root cause of application errors
- Diagnose AOS-specific failures (Function App, Service Bus, Key Vault)
When to Use This Skill
- Deployment failures in Azure
- Performance degradation of deployed resources
- Connectivity issues between Azure services
- Resource provisioning errors
- Configuration problems
- After automated diagnostics detect issues
Quick Diagnosis Flow
- Identify symptoms — What's failing? Error code? Service?
- Check resource health — Is Azure healthy? Use AppLens or Resource Health API.
- Review logs — What do logs show? Use KQL queries in Log Analytics.
- Analyze metrics — Performance patterns with Azure Monitor.
- Investigate recent changes — What changed? Check Activity Log.
MCP Tools
When Azure MCP is enabled, prefer these tools over CLI for faster diagnostics:
AppLens (AI-Powered Diagnostics)
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 (Logs & Metrics)
mcp_azure_mcp_monitor
intent: "query logs for <resource-name>"
command: "logs_query"
parameters:
workspaceId: "<log-analytics-workspace-id>"
query: "<KQL-query>"
See KQL Query Reference for common diagnostic queries.
Resource Health
mcp_azure_mcp_resourcehealth
intent: "check health status of <resource-name>"
command: "get"
parameters:
resourceId: "<resource-id>"
Azure Resource Graph (Cross-Resource Diagnostics)
Use the Resource Graph for fast cross-subscription queries to find failed or unhealthy resources:
az graph query -q "HealthResources | where properties.availabilityState != 'Available' | project name, state=properties.availabilityState"
See Azure Resource Graph Queries for diagnostic query patterns.
Common Azure Issues and Resolutions
1. Deployment Failures
Issue: Resource Name Already Exists
Symptoms:
Error: A resource with the name 'aos-storage' already exists
Code: ResourceExists
Resolution:
az resource list --name aos-storage
az resource delete --ids $(az resource list --name aos-storage --query "[0].id" -o tsv)
Issue: Quota Exceeded
Symptoms:
Error: Operation could not be completed as it results in exceeding approved quota
Code: QuotaExceeded
Diagnosis:
az vm list-usage --location eastus --query "[?currentValue >= maximumValue]" -o table
Resolution:
- Request quota increase through Azure portal
- Use different region with available capacity
- Delete unused resources to free up quota
- Use smaller SKUs if applicable
Issue: Invalid Template (BCP Errors)
Symptoms:
Error BCP029: The resource type is not valid
Error BCP033: Expected value type mismatch
Resolution:
- Use deployment-error-fixer skill for automatic fixes
- Validate Bicep templates:
az bicep build --file template.bicep
- Check API version compatibility
- Verify parameter types
2. Performance Issues
Issue: High Response Time in Function Apps
Symptoms:
- Slow API responses (>5 seconds)
- Timeout errors
Diagnosis:
RESOURCE_ID=$(az functionapp show -g rg-aos-dev -n aos-func --query id -o tsv)
az monitor metrics list \
--resource $RESOURCE_ID \
--metric "AverageResponseTime" \
--aggregation Average
Common Causes:
- Cold starts (function went idle)
- Under-provisioned resources
- Inefficient code
- Slow external dependencies
- Throttling
Resolution:
az functionapp config set -g rg-aos-dev -n aos-func --always-on true
az functionapp plan update -g rg-aos-dev -n aos-plan --sku P1V2
az functionapp plan update -g rg-aos-dev -n aos-plan --number-of-workers 3
3. Connectivity Issues
Issue: Service Bus Connection Failed
Symptoms:
Error: ServiceUnavailable
Error: Unauthorized
Resolution:
- Verify Service Bus is running
- Check connection string in Function App settings
- Verify network rules
- Check Managed Identity permissions
Issue: Storage Account Access Denied
Symptoms:
Error: AuthorizationPermissionMismatch
Resolution:
PRINCIPAL_ID=$(az functionapp identity show -g rg-aos-dev -n aos-func --query principalId -o tsv)
STORAGE_ID=$(az storage account show -g rg-aos-dev -n aosstoragedev --query id -o tsv)
az role assignment create \
--assignee $PRINCIPAL_ID \
--role "Storage Blob Data Contributor" \
--scope $STORAGE_ID
4. Key Vault Access Issues
Symptoms:
Error: Forbidden - No secrets get permission
Resolution:
PRINCIPAL_ID=$(az functionapp identity show -g rg-aos-dev -n aos-func --query principalId -o tsv)
az keyvault set-policy \
-g rg-aos-dev \
-n aos-keyvault \
--object-id $PRINCIPAL_ID \
--secret-permissions get list
Troubleshooting Workflow
Step 1: Identify the Problem
- What is failing?
- When did it start?
- What changed recently?
- Is it intermittent or consistent?
Step 2: Collect Diagnostics
gh workflow run infrastructure-troubleshooting.yml \
-f environment=dev \
-f issue_type=deployment_failure
az monitor activity-log list \
-g rg-aos-dev \
--query "[?level=='Error']" \
-o table
Step 3: Analyze Root Cause
- Check error codes and messages
- Review recent changes
- Check for known issues
- Correlate with other events
Step 4: Implement Fix
- Start with least disruptive fix
- Test in dev first
- Document the fix
- Monitor after applying
Step 5: Verify Resolution
- Confirm issue resolved
- Check for side effects
- Update monitoring if needed
Common Error Codes
| Code | Meaning | Resolution |
|---|
| ResourceNotFound | Resource doesn't exist | Verify name, create resource |
| ResourceExists | Already exists | Use different name or delete |
| QuotaExceeded | Limit reached | Request increase or use different region |
| InvalidTemplate | Syntax error | Fix template, use linter |
| Unauthorized | Auth failed | Check credentials, add RBAC |
| Forbidden | Permission denied | Add required permissions |
| Conflict | Conflicting operation | Wait and retry |
| Throttled | Rate limited | Implement backoff |
| ServiceUnavailable | Transient failure | Retry, check Azure status |
Diagnostic Commands
az resource list -g rg-aos-dev -o table
az monitor activity-log list -g rg-aos-dev --max-events 50
az deployment group list -g rg-aos-dev
curl -v https://<endpoint>
az functionapp logs tail --name <function-app-name> -g rg-aos-dev
az monitor log-analytics query \
--workspace <workspace-id> \
--analytics-query "AppRequests | where Success == false | take 20"
az graph query -q "Resources | where properties.provisioningState != 'Succeeded' | project name, type, resourceGroup, provisioningState=properties.provisioningState"
KQL Queries
See KQL Query Reference for commonly used queries:
- Recent errors and exceptions
- Failed and slow requests
- Dependency failures
Azure Resource Graph
See Azure Resource Graph Queries for:
- Cross-subscription health status queries
- Failed or stuck deployment detection
- Active service health incidents
Best Practices
Prevention:
- Use Infrastructure as Code
- Implement monitoring
- Use health checks
- Follow naming conventions
- Test in dev first
- Document changes
- Use Managed Identities
- Enable diagnostic logging
During Incidents:
- Stay calm
- Collect data first
- Document steps
- Communicate updates
- Use systematic approach
- Escalate when needed
After Resolution:
- Document root cause
- Implement preventive measures
- Update monitoring
- Share learnings
- Update runbooks
Integration with Workflows
Use the infrastructure-troubleshooting workflow for automated diagnostics and comprehensive reports.
Related Documentation
Summary
This skill provides:
- ✅ Systematic troubleshooting procedures
- ✅ Common Azure error patterns
- ✅ Diagnostic command reference
- ✅ Best practices for prevention
- ✅ Integration with automated workflows