azure-cost

Query, forecast, and optimize Azure spending using the Cost Management API.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/merceralex397-collab/alex-stack --skill azure-cost-merceralex397-collab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: azure-cost
Source: https://github.com/merceralex397-collab/alex-stack/tree/main/dev/azure-profile/azure-skills-main/azure-skills-main/.github/plugins/azure-skills/skills/azure-cost
Command: npx skills add https://github.com/merceralex397-collab/alex-stack --skill azure-cost-merceralex397-collab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Understanding and controlling Azure cloud spending requires navigating complex Cost Management APIs, scope rules, and dimension constraints. This Skill provides structured workflows to query historical costs, forecast future spending, and identify waste such as orphaned resources and oversized SKUs. ## Core Features & Use Cases - Cost Querying: Retrieve actual or amortized costs by service, resource group, tag, or resource ID across subscriptions, management groups, and billing accounts. - Cost Forecasting: Project future spending with daily or monthly granularity using the Forecast API, including actuals alongside predictions. - Cost Optimization: Detect orphaned disks, idle load balancers, and oversized resources via Azure Resource Graph and azqr, with specialized guides for Redis, Storage, and AKS. - Use Case: A user asks "why did my Azure bill spike last week?" — the Skill pulls cost data grouped by resource, correlates with Azure Monitor metrics, and produces an optimization report with prioritized savings recommendations. ## Quick Start Ask the assistant to show your Azure cost breakdown by service for the current month using your subscription ID.

Frequently Asked Questions about azure-cost

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query Azure costs by service or resource group?▼

Use the Cost Management Query API via az rest with a POST to {scope}/providers/Microsoft.CostManagement/query. Specify a dataset with aggregation on Cost and grouping by ServiceName or ResourceGroupName, with a timeframe like MonthToDate or a custom date range.

How do I forecast future Azure spending?▼

Call the Cost Management Forecast API with a Custom timeframe where the to date is in the future. The API requires at least 28 days of historical cost data and supports Daily or Monthly granularity, but does not support grouping.

What Azure permissions are needed for cost management queries?▼

You need the Cost Management Reader role plus Monitoring Reader and Reader roles on the target scope. Without these, the API returns 403 Forbidden errors.

Why does grouping by ResourceId fail in Azure cost queries?▼

ResourceId grouping is only supported at subscription and resource group scopes. At billing account, management group, or higher scopes, use ServiceName or SubscriptionName dimensions instead.

How do I find orphaned Azure resources that waste money?▼

Use Azure Resource Graph KQL queries to find unattached managed disks, orphaned NICs, and idle load balancers, or run an Azure Quick Review (azqr) scan. Cross-reference findings with actual cost data before deleting anything.

What are the Azure Cost Management API rate limits?▼

Limits include 20 requests per minute per user and 4 requests per minute per scope, which is the most restrictive. On a 429 response, check all x-ms-ratelimit retry-after headers and wait for the longest value before retrying, with a maximum of 3 retries.