Analyzes Azure resource group costs, identifies optimization opportunities, and generates professional FinOps reports. This skill should be used when the user wants to analyze Azure resource group spending, find orphaned resources, get cost optimization recommendations, or generate cost analysis reports. Invoked with a resource group name and optional region.
Analyze an Azure resource group to produce a comprehensive cost optimization report following Microsoft Well-Architected Framework and FinOps Foundation best practices.
Arguments:
$0 - Resource Group name (required)$1 - Region for pricing context (optional, defaults to auto-detect from RG)Output: ~/azure-cost-analysis/{rg-name}-cost-analysis.md
Run the pre-flight check script to validate the environment:
bash scripts/az-preflight-check.sh "$0"
If pre-flight fails, report the specific failure and stop. Common issues:
az loginEnumerate all resources in the resource group and categorize by type:
az resource list --resource-group "$0" --output json
Build a resource inventory table with: Name, Type, SKU/Tier, Location, Tags.
Determine which analysis categories apply based on discovered resource types:
Spawn 4 azure-infra-engineer agents via the Task tool, each analyzing their assigned category. Pass the resource group name and the list of relevant resources to each agent.
Agent 1 - Compute & Apps Analyst:
Instruct the agent to analyze compute and application resources in resource group $0. For each resource found:
Use commands from the references/azure-cli-commands.md reference. Save findings to ~/azure-cost-analysis/$0-compute-analysis.md.
Agent 2 - Data & Cache Analyst:
Instruct the agent to analyze data and caching resources in resource group $0. For each resource found:
Use commands from the references/azure-cli-commands.md reference. Save findings to ~/azure-cost-analysis/$0-data-analysis.md.
Agent 3 - Monitoring & Certs Analyst:
Instruct the agent to analyze monitoring and certificate resources in resource group $0. For each resource found:
Use commands from the references/azure-cli-commands.md reference. Save findings to ~/azure-cost-analysis/$0-monitoring-analysis.md.
Agent 4 - Cost & Governance Analyst:
Instruct the agent to analyze cost trends and governance for resource group $0:
references/resource-graph-queries.mdUse commands from the references/azure-cli-commands.md reference. Save findings to ~/azure-cost-analysis/$0-cost-governance-analysis.md.
After parallel agents complete, run additional cross-cutting analysis:
# Orphaned resource detection
az graph query -q "Resources | where resourceGroup =~ '$0' | where type =~ 'microsoft.network/publicipaddresses' | where properties.ipConfiguration == ''" --output json
Load queries from references/resource-graph-queries.md and execute each one scoped to the target resource group. Compile a list of orphaned/zombie resources.
Merge all agent findings into a single professional report. Use the template structure from references/report-template.md:
~/azure-cost-analysis/$0-*-analysis.mdreferences/pricing-reference.md~/azure-cost-analysis/$0-cost-analysis.mdPresent to the user:
references/safety-checklist.mdLoad these as needed during analysis:
az CLI command to execute it