Generated banner for Cost Analysis
Generated logo for Cost Analysis

Cost Analysis

MicrosoftOfficialCreated by Microsoft

  • Skill
  • Research and analysis
  • Cloud and DevOps
  • MIT
  • No issues found

From the author

Analyze actual Azure spend, bill changes, and AKS or AI costs. WHEN: "Azure cost breakdown", "most expensive resources", "why did my bill increase", "cost spike", "unexpected charge", "Cosmos DB charges", "Foundry model costs", "AKS cluster cost", "namespace cost", "enable AKS cost analysis", "idle AKS capacity". DO NOT USE FOR: forecasts, pricing estimates, rightsizing, commitments, or budgets.
— the description by Microsoft

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

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/microsoft/cost-analysis/download
  2. Unzip 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

IntentWorkflowPrimary tools
Query historical spendCost queryquery_costs
Explain a spikeCost investigationquery_costs, Resource Graph
Analyze AKS spendAKS cost analysisquery_aks_costs, Resource Graph
Analyze AI service spendAI cost analysisquery_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

  1. Confirm scope, period, currency, and breakdown.

  2. Load only the matching workflow above.

  3. Never transform MCP results in a shell or interpreter; request tool-side totals, grouping, sorting, or bounded follow-up queries.

  4. Respect row limits and label incomplete data.

  5. Separate measured cost from inferred causes and recommendations.

Error Handling

ErrorAction
Access deniedName the required scope and role.
Empty resultDistinguish no data from unavailable data.
Multiple currenciesReport each currency separately.
Server errorRetry once; then stop with the trace ID.

Files

references/cost-investigation.md

Cost Investigation

Explain what changed before recommending remediation.

Establish the Baseline

  1. Confirm scope, anomaly window, currency, and whether the concern is a daily spike, sustained increase, or invoice-level change. Exclude an incomplete current day unless the user explicitly wants partial data.

  2. Call query_costs with daily granularity for the anomaly and an equal-length baseline. Prefer comparable weekdays, billing-cycle position, and known seasonal or deployment periods over an arbitrary preceding window.

  3. Request separate granularity=None totals for the anomaly and baseline; never sum daily rows in a shell or local interpreter. Calculate the absolute and percentage delta from those returned totals per currency. Keep actual and amortized cost separate; use amortized cost when commitment purchases could distort the usage trend.

Find the Driver

  1. Start with ServiceName, rank by absolute delta, then narrow the leading service through separate bounded queries by ResourceGroupName, ResourceId, and Meter where those dimensions are supported. Reuse exact values returned by the broader query instead of guessing filter values.

  2. Query ChargeType and PricingModel to distinguish recurring usage, purchases, refunds, credits, marketplace charges, and commitment effects. Do not attribute a shared or unallocated charge to one resource without evidence.

  3. Prefer one billing-scope request over many subscription requests when the subscriptions share an accessible billing scope. Otherwise limit fan-out, sort by cost descending, and disclose partial results.

Correlate the Cause

  1. For the leading resources, query Resource Graph resourcechanges around the anomaly. Run generate_query, validate_query, then execute_query. Inspect creates, deletes, SKU or tier changes, scale events, region changes, and ownership-tag changes.

  2. Correlate only evidence from matching resources and time windows. A change near a spike is a candidate cause, not proof. Resolve likely ownership from resource groups and the organization's actual owner or cost-allocation tags; tag names are case-sensitive.

  3. Classify the result as recurring or one-time and controllable or expected. Assign high confidence only when cost, resource, meter, and change evidence align. Use medium or low confidence when attribution is indirect.

Use the cost-query workflow for limits, pagination, query errors, and API fallback.

Report

Present:

  • anomaly and baseline windows;

  • absolute and percentage change per currency;

  • leading service, resource group, resource, meter, charge type, and pricing model;

  • correlated resource changes and likely owner;

  • classification, confidence, evidence gaps, and one next action.

Change history is short-lived, and empty results can reflect retention, permissions, or unsupported attribution. Never treat missing evidence as proof that nothing changed.

Handoffs

  • Overprovisioning or cleanup opportunity: cost-optimization.

  • Reservation or Savings Plan change: cost-optimization commitment workflow.

  • AKS driver: AKS cost analysis.

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