Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Analyze Azure subscriptions to find cost savings via orphaned resources, rightsizing, and usage data
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: azure-cost3description: "Unified Azure cost management: query historical costs, forecast future spending, and optimize to reduce waste. WHEN: \"Azure costs\", \"Azure spending\", \"Azure bill\", \"cost breakdown\", \"cost by service\", \"cost by resource\", \"how much am I spending\", \"show my bill\", \"monthly cost summary\", \"cost trends\", \"top cost drivers\", \"actual cost\", \"amortized cost\", \"forecast spending\", \"projected costs\", \"estimate bill\", \"future costs\", \"budget forecast\", \"end of month costs\", \"how much will I spend\", \"optimize costs\", \"reduce spending\", \"find cost savings\", \"orphaned resources\", \"rightsize VMs\", \"cost analysis\", \"reduce waste\", \"unused resources\", \"optimize Redis costs\", \"cost by tag\", \"cost by resource group\", \"AKS cost analysis add-on\", \"namespace cost\", \"cost spike\", \"anomaly\", \"budget alert\", \"AKS cost visibility\". DO NOT USE FOR: deploying resources, provisioning infrastructure, diagnostics, security audits, or estimating costs for new resources not yet deployed."4license: MIT5metadata:6author: Microsoft7version: "1.2.1"8---910# Azure Cost Management Skill1112Unified skill for all Azure cost management tasks: querying historical costs, forecasting future spending, and optimizing to reduce waste.1314## When to Use This Skill1516Activate this skill when user wants to:17- Query or analyze Azure costs (how much am I spending, show my bill, cost breakdown)18- Break down costs by service, resource, location, or tag19- Analyze cost trends over time20- Forecast future Azure spending or project end-of-month costs21- Optimize Azure costs, reduce spending, or find savings22- Find orphaned or unused resources23- Rightsize Azure VMs, containers, or services24- Generate cost optimization reports2526## Quick Reference2728| Property | Value |29|----------|-------|30| **Query API Endpoint** | `POST {scope}/providers/Microsoft.CostManagement/query?api-version=2023-11-01` |31| **Forecast API Endpoint** | `POST {scope}/providers/Microsoft.CostManagement/forecast?api-version=2023-11-01` |32| **MCP Tools** | `azure__documentation`, `azure__extension_cli_generate`, `azure__get_azure_bestpractices` |33| **CLI** | `az rest`, `az monitor metrics list`, `az resource list` |34| **Required Role** | Cost Management Reader + Monitoring Reader + Reader on scope |3536## MCP Tools3738| Tool | Description | Parameters | When to Use |39|------|-------------|------------|-------------|40| `azure__documentation` | Search Azure documentation | `query` (Required): search terms | Research Cost Management API parameters and options |41| `azure__extension_cli_generate` | Generate Azure CLI commands | `intent` (Required): task description, `cli-type` (Required): `"az"` | Construct `az rest` commands for cost queries |42| `azure__get_azure_bestpractices` | Get Azure best practices | `intent` (Required): optimization context | Inform query design with cost management best practices |43| `azure__extension_azqr` | Run Azure Quick Review compliance scan | `subscription` (Required): subscription ID, `resource-group` (Optional): resource group name | Find orphaned resources and cost optimization opportunities |44| `azure__aks` | Azure Kubernetes Service operations | varies by sub-command | AKS cost analysis: list clusters, get node pools, inspect configuration |4546> ๐ก **Tip:** Prefer MCP tools over direct CLI commands. Use `az rest` only when MCP tools don't cover the specific operation.4748---4950## Routing5152Read the user's request and follow the appropriate workflow below.5354| User Intent | Workflow | Example Prompts |55|-------------|----------|-----------------|56| Understand current costs | [Cost Query Workflow](cost-query/workflow.md) | "how much am I spending", "cost by service", "show my bill" |57| Reduce costs / find waste | [Cost Optimization Workflow](cost-optimization/workflow.md) | "optimize costs", "find orphaned resources", "reduce spending" |58| Project future costs | [Cost Forecast Workflow](cost-forecast/workflow.md) | "forecast costs", "end of month estimate", "how much will I spend" |59| Full cost picture | All three workflows combined | "give me the full picture of my Azure costs" |6061> **Important:** When optimizing costs, always present the total bill and cost breakdown alongside optimization recommendations.6263---6465## Scope Reference (Shared Across All Workflows)6667| Scope | URL Pattern |68|-------|-------------|69| Subscription | `/subscriptions/<subscription-id>` |70| Resource Group | `/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>` |71| Management Group | `/providers/Microsoft.Management/managementGroups/<management-group-id>` |72| Billing Account | `/providers/Microsoft.Billing/billingAccounts/<billing-account-id>` |73| Billing Profile | `/providers/Microsoft.Billing/billingAccounts/<billing-account-id>/billingProfiles/<billing-profile-id>` |7475> ๐ก **Tip:** These are scope paths only โ not complete URLs. Combine with the API endpoint and version.7677---7879## Part 1: Cost Query Workflow8081For the full cost query workflow (scope selection, report types, timeframes, dataset configuration, API calls, pagination, guardrails, examples, and error handling), see:8283๐ **[Cost Query Workflow](cost-query/workflow.md)**8485---8687## Part 2: Cost Optimization Workflow8889For the full cost optimization workflow (prerequisites, best practices, Redis/AKS-specific analysis, Azure Quick Review, resource discovery, cost queries, pricing validation, utilization metrics, and report generation), see:9091๐ **[Cost Optimization Workflow](cost-optimization/workflow.md)**9293---9495## Part 3: Cost Forecast Workflow9697For the full cost forecast workflow (scope selection, time period rules, dataset configuration, forecast-specific options, API calls, response interpretation, guardrails, and error handling), see:9899๐ **[Cost Forecast Workflow](cost-forecast/workflow.md)**100101---102103## Data Classification104105- **ACTUAL DATA** = Retrieved from Azure Cost Management API106- **ACTUAL METRICS** = Retrieved from Azure Monitor107- **VALIDATED PRICING** = Retrieved from official Azure pricing pages108- **ESTIMATED SAVINGS** = Calculated based on actual data and validated pricing109110## Best Practices111112- Always query actual costs first โ never estimate or assume113- Always present the total bill alongside optimization recommendations114- Validate pricing from official sources โ account for free tiers115- Use REST API for cost queries (more reliable than `az costmanagement query`)116- Always include the `ClientType: GitHubCopilotForAzure` header on all Cost Management API requests (`--headers "ClientType=GitHubCopilotForAzure"` in `az rest`)117- Save audit trail โ include all queries and responses118- Include Azure Portal links for all resources119- For costs < $10/month, emphasize operational improvements over financial savings120- Never execute destructive operations without explicit approval121- On 429 responses, check all `x-ms-ratelimit-microsoft.costmanagement-*-retry-after` headers (`qpu-retry-after`, `entity-retry-after`, `tenant-retry-after`), wait for the longest value, and do not retry until that duration has elapsed. The per-scope limit (4 requests/minute) is the most restrictive.122123## Common Pitfalls124125- **Assuming costs**: Always query actual data from Cost Management API126- **Ignoring free tiers**: Many services have generous allowances127- **Using wrong date ranges**: 30 days for costs, 14 days for utilization128- **Not showing the bill**: Always present cost breakdown alongside optimization recommendations129- **Cost query failures**: Use `az rest` with JSON body, not `az costmanagement query`130131## Safety Requirements132133- Get approval before deleting resources134- Test changes in non-production first135- Provide dry-run commands for validation136- Include rollback procedures137138## SDK Quick References139140- **Redis Management**: [.NET](cost-optimization/sdk/azure-resource-manager-redis-dotnet.md)141