Cost Analysis
MicrosoftOfficialCreated by Microsoft
- Skill
- Research and analysis
- Cloud and DevOps
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The cost-analysis skill provides a structured approach to investigating historical Azure billing data. It focuses on identifying cost drivers, explaining anomalies, and breaking down expenditures for specific services like Azure Kubernetes Service (AKS) and AI models. The skill emphasizes using official billing dimensions and resource graphs to provide evidence-based reports while strictly avoiding speculative tasks like forecasting, pricing estimates, or rightsizing recommendations.
What it does
- Queries historical Azure spend by scope, period, and currency.
- Investigates cost spikes and unexpected charges using billing dimensions.
- Analyzes AKS cluster and namespace cost allocation.
- Breaks down AI service and model-related costs.
- Correlates billing data with operational evidence from Resource Graph.
- Distinguishes between measured costs and inferred causes.
When to use it
- When you need a breakdown of your current Azure bill.
- When investigating a sudden cost spike or unexpected charge.
- When analyzing the cost distribution across AKS namespaces.
- When identifying the most expensive resources in your subscription.
- When correlating AI service spend with specific resource usage.
Advantages
- Provides evidence-based analysis using official billing data.
- Maintains clear separation between measured costs and inferred contributors.
- Standardizes the investigation process for AKS and AI service costs.
- Prevents speculative errors by excluding forecasting and rightsizing.
Usage examples
- “Why did my Azure bill increase last month?”
- The agent will query historical cost data for the specified period, identify the primary service or resource contributors to the increase, and report the findings.
- “Show me the cost breakdown for my AKS namespaces.”
- The agent will use the AKS cost analysis workflow to retrieve and present the cost allocation per namespace, including idle or unallocated charges.
- “What are the most expensive resources in my subscription?”
- The agent will perform a cost query grouped by resource to identify and list the top contributors to your current Azure spend.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/microsoft/cost-analysis/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cost-analysis.zip -d .agents/skills
Documentation by Microsoft
Azure Cost Analysis
Quick Reference
| Intent | Workflow | Primary tools |
|---|---|---|
| Query historical spend | Cost query | query_costs |
| Explain a spike | Cost investigation | query_costs, Resource Graph |
| Analyze AKS spend | AKS cost analysis | query_aks_costs, Resource Graph |
| Analyze AI service spend | AI cost analysis | query_costs |
When to Use This Skill
Use for spend, anomalies, and AKS or AI allocation.
MCP Tools
Use cost tools and Resource Graph first. If an operation is unavailable, follow fallback and safety.
Workflow
Confirm scope, period, currency, and breakdown.
Load only the matching workflow above.
Never transform MCP results in a shell or interpreter; request tool-side totals, grouping, sorting, or bounded follow-up queries.
Respect row limits and label incomplete data.
Separate measured cost from inferred causes and recommendations.
Error Handling
| Error | Action |
|---|---|
| Access denied | Name the required scope and role. |
| Empty result | Distinguish no data from unavailable data. |
| Multiple currencies | Report each currency separately. |
| Server error | Retry once; then stop with the trace ID. |
Files
- ATTRIBUTION.mdAdded by AutoGineer965 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md1.9 KiB
- references/ai-cost-analysis.md2.1 KiB
- references/aks-anomaly.md4.5 KiB
- references/aks-cost-analysis.md1.5 KiB
- references/aks-enablement.md1.4 KiB
- references/cost-investigation.md3.2 KiB
- references/cost-query/dimensions-by-scope.md1.5 KiB
- references/cost-query/error-handling.md1.5 KiB
- references/cost-query/examples.md1.2 KiB
- references/cost-query/guardrails.md1.7 KiB
- references/cost-query/request-body-schema.md1.4 KiB
- references/cost-query/workflow.md2.6 KiB
- references/tools-and-safety.md2.2 KiB
references/cost-query/workflow.md
Cost Query Workflow
Use this workflow for cost totals, breakdowns, trends, and top spenders.
1. Determine scope and period
Use the narrowest Azure scope that answers the question. query_costs defaults
to month-to-date. Custom dates use YYYY-MM-DD, must be supplied as a
from/to pair, and cannot exceed the rolling 92-day lookback.
Supported timeframes are MonthToDate, BillingMonthToDate, TheLastMonth,
TheLastBillingMonth, WeekToDate, TheCurrentMonth, and Custom.
2. Configure the tool call
| Parameter | Contract |
|---|---|
metric | PreTaxCost (default), Cost, or AmortizedCost |
granularity | None (default), Daily, or Monthly |
groupBy | Up to five comma-separated supported dimensions |
filterDimension + filterValues | Supply both; values are comma-separated exact matches |
sortBy | Cost column or selected grouping dimension |
sortDirection | desc (default), asc, descending, or ascending |
top | 1-5000 rows; default 100 |
Use dimensions by scope to select dimensions. Resource- and meter-level dimensions require a subscription or resource-group scope. Tag grouping and filtering are not supported by this MCP tool.
3. Execute and interpret
Call query_costs. If the operation is unavailable, use the Cost Management
Query API through the approved fallback process.
Preserve the response column order, currency, metric, scope, and period. Keep
different currencies separate.
Request granularity=None when the answer needs a total instead of summing
daily rows. For weekly comparisons, issue one bounded custom-period query per
week, with granularity=None and only the required grouping, rather than
locally parsing or time-bucketing a larger response.
The tool has no continuation input. If the requested data exceeds top, raise
top to at most 5000 or narrow the scope, period, or grouping. State when the
result may be incomplete.
Error handling
| Error | Action |
|---|---|
| Unsupported timeframe, metric, dimension, or sort | Use a value exposed by the tool contract. |
Missing from/to or filter pair | Supply both members of the pair. |
| Date outside 92 days | Narrow the period; fallback does not bypass this guardrail. |
| Throttled | Honor the retry guidance returned by the tool and reduce fan-out. |
| More than about 10 subscriptions | Ask the user to narrow scope. |
See examples, parameter contract, and guardrails. Use cost query errors for tool-specific remediation.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills · .github/plugins/azure-cost/skills/cost-analysis · commit 0696600
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from .github/plugins/azure-cost/LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cost-analysis.zip