azure-cost-optimization▌
microsoft/azure-skills · updated May 14, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Identify cost savings across Azure subscriptions through resource analysis, utilization metrics, and actionable optimization recommendations.
- ›Discovers orphaned resources (unattached disks, unused NICs, idle gateways) and over-provisioned services using Azure Quick Review
- ›Queries actual costs from Azure Cost Management API and utilization data from Azure Monitor to support rightsizing recommendations
- ›Generates prioritized optimization reports with estimated savings, implementation co
Azure Cost Optimization Skill
Analyze Azure subscriptions to identify cost savings through orphaned resource cleanup, rightsizing, and optimization recommendations based on actual usage data.
When to Use This Skill
Use this skill when the user asks to:
- Optimize Azure costs or reduce spending
- Analyze Azure subscription for cost savings
- Generate cost optimization report
- Find orphaned or unused resources
- Rightsize Azure VMs, containers, or services
- Identify where they're overspending in Azure
- Optimize Redis costs specifically - See Azure Redis Cost Optimization for Redis-specific analysis
Instructions
Follow these steps in conversation with the user:
Step 0: Validate Prerequisites
Before starting, verify these tools and permissions are available:
Required Tools:
- Azure CLI installed and authenticated (
az login) - Azure CLI extensions:
costmanagement,resource-graph - Azure Quick Review (azqr) installed - See Azure Quick Review for details
Required Permissions:
- Cost Management Reader role
- Monitoring Reader role
- Reader role on subscription/resource group
Verification commands:
az --version
az account show
az extension show --name costmanagement
azqr version
Step 1: Load Best Practices
Get Azure cost optimization best practices to inform recommendations:
// Use Azure MCP best practices tool
mcp_azure_mcp_get_azure_bestpractices({
intent: "Get cost optimization best practices",
command: "get_bestpractices",
parameters: { resource: "cost-optimization", action: "all" }
})
Step 1.5: Redis-Specific Analysis (Conditional)
If the user specifically requests Redis cost optimization, use the specialized Redis skill:
📋 Reference: Azure Redis Cost Optimization
When to use Redis-specific analysis:
- User mentions "Redis", "Azure Cache for Redis", or "Azure Managed Redis"
- Focus is on Redis resource optimization, not general subscription analysis
- User wants Redis-specific recommendations (SKU downgrade, failed caches, etc.)
Key capabilities:
- Interactive subscription filtering (prefix, ID, or "all subscriptions")
- Redis-specific optimization rules (failed caches, oversized tiers, missing tags)
- Pre-built report templates for Redis cost analysis
- Uses
redis_listcommand
Report templates available:
Note: For general subscription-wide cost optimization (including Redis), continue with Step 2. For Redis-only focused analysis, follow the instructions in the Redis-specific reference document.
Step 1.6: Choose Analysis Scope (for Redis-specific analysis)
If performing Redis cost optimization, ask the user to select their analysis scope:
Prompt the user with these options:
- Specific Subscription ID - Analyze a single subscription
- Subscription Name - Use display name instead of ID
- Subscription Prefix - Analyze all subscriptions starting with a prefix (e.g., "CacheTeam")
- All My Subscriptions - Scan all accessible subscriptions
- Tenant-wide - Analyze entire organization
Wait for user response, then proceed to Step 2.
Step 1.7: AKS-Specific Analysis (Conditional)
If the user specifically requests AKS cost optimization, use the specialized AKS reference files:
When to use AKS-specific analysis:
- User mentions "AKS", "Kubernetes", "cluster", "node pool", "pod", or "kubectl"
- User wants to enable the AKS cost analysis add-on or namespace cost visibility
- User reports a cost spike, unusual cluster utilization, or wants budget alerts
Tool Selection:
- Prefer MCP first: Use
mcp_azure_mcp_aksfor AKS operations (list clusters, get node pools, inspect configuration) — it provides richer metadata and is consistent with AKS skill conventions in this repo - Fall back to CLI: Use
az aksandkubectlonly when the specific operation cannot be performed via the MCP surface
Reference files (load only what is needed for the request):
- Cost Analysis Add-on — enable namespace-level cost visibility
- Anomaly Investigation — cost spikes, scaling events, budget alerts
Note: For general subscription-wide cost optimization (including AKS resource groups), continue with Step 2. For AKS-focused analysis, follow the instructions in the relevant reference file above.
Step 1.8: Choose Analysis Scope (for AKS-specific analysis)
If performing AKS cost optimization, ask the user to select their analysis scope:
Prompt the user with these options:
- Specific Cluster Name - Analyze a single AKS cluster
- Resource Group - Analyze all clusters in a resource group
- Subscription ID - Analyze all clusters in a subscription
- All My Clusters - Scan all accessible clusters across subscriptions
Wait for user response before proceeding to Step 2.
Step 2: Run Azure Quick Review
Run azqr to find orphaned resources (immediate cost savings):
📋 Reference: Azure Quick Review - Detailed instructions for running azqr scans
// Use Azure MCP extension_azqr tool
extension_azqr({
subscription: "<SUBSCRIPTION_ID>",
"resource-group": "<RESOURCE_GROUP>" // optional
})
What to look for in azqr results:
- Orphaned resources: unattached disks, unused NICs, idle NAT gateways
- Over-provisioned resources: excessive retention periods, oversized SKUs
- Missing cost tags: resources without proper cost allocation
Note: The Azure Quick Review reference document includes instructions for creating filter configurations, saving output to the
output/folder, and interpreting results for cost optimization.
Step 3: Discover Resources
For efficient cross-subscription resource discovery, use Azure Resource Graph. See Azure Resource Graph Queries for orphaned resource detection and cost optimization patterns.
List all resources in the subscription using Azure MCP tools or CLI:
# Get subscription info
az account show
# List all resources
az resource list --subscription "<SUBSCRIPTION_ID>" --resource-group "<RESOURCE_GROUP>"
# Use MCP tools for specific services (preferred):
# - Storage accounts, Cosmos DB, Key Vaults: use Azure MCP tools
# - Redis caches: use mcp_azure_mcp_redis tool (see ./references/azure-redis.md)
# - Web apps, VMs, SQL: use az CLI commands
Step 4: Query Actual Costs
Get actual cost data from Azure Cost Management API (last 30 days):
Create cost query file:
Create temp/cost-query.json with:
{
"type": "ActualCost",
"timeframe": "Custom",
"timePeriod": {
"from": "<START_DATE>",
"to": "<END_DATE>"
},
"dataset": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "ResourceId"
}
]
}
}
Action Required: Calculate
<START_DATE>(30 days ago) and<END_DATE>(today) in ISO 8601 format (e.g.,2025-11-03T00:00:00Z).
Execute cost query:
# Create temp folder
New-Item -ItemType Directory -Path "temp" -Force
# Query using REST API (more reliable than az costmanagement query)
az rest --method post `
--url "https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.CostManagement/query?api-version=2023-11-01" `
--body '@temp/cost-query.json'
Important: Save the query results to output/cost-query-result<timestamp>.json for audit trail.
Step 5: Validate Pricing
Fetch current pricing from official Azure pricing pages using fetch_webpage:
// Validate pricing for key services
fetch_webpage({
urls: ["https://azure.microsoft.com/en-us/pricing/details/container-apps/"],
query: "pricing tiers and costs"
})
Key services to validate:
- Container Apps: https://azure.microsoft.com/pricing/details/container-apps/
- Virtual Machines: https://azure.microsoft.com/pricing/details/virtual-machines/
- App Service: https://azure.microsoft.com/pricing/details/app-service/
- Log Analytics: https://azure.microsoft.com/pricing/details/monitor/
Important: Check for free tier allowances - many Azure services have generous free limits that may explain $0 costs.
Step 6: Collect Utilization Metrics
Query Azure Monitor for utilization data (last 14 days) to support rightsizing recommendations:
# Calculate dates for last 14 days
$startTime = (Get-Date).AddDays(-14).ToString("yyyy-MM-ddTHH:mm:ssZ")
$endTime = Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ"
# VM CPU utilization
az monitor metrics list `
--resource "<RESOURCE_ID>" `
--metric "Percentage CPU" `
--interval PT1H `
--aggregation Average `
--start-time $startTime `
--end-time $endTime
# App Service Plan utilization
az monitor metrics list `
--resource "<RESOURCE_ID>" `
--metric "CpuTime,Requests" `
--interval PT1H `
--aggregation Total `
--start-time $startTime `
--end-time $endTime
# Storage capacity
az monitor metrics list `
--resource "<RESOURCE_ID>" `
--metric "UsedCapacity,BlobCount" `
--interval PT1H `
--aggregation Average `
--start-time $startTime `
--end-time $endTime
Step 7: Generate Optimization
How to use azure-cost-optimization on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add azure-cost-optimization
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches azure-cost-optimization from GitHub repository microsoft/azure-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate azure-cost-optimization. Access the skill through slash commands (e.g., /azure-cost-optimization) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★33 reviews- ★★★★★Mia Ndlovu· Dec 16, 2024
Keeps context tight: azure-cost-optimization is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Dhruvi Jain· Dec 8, 2024
azure-cost-optimization is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Oshnikdeep· Nov 27, 2024
Keeps context tight: azure-cost-optimization is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Ira Sharma· Nov 7, 2024
azure-cost-optimization is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Arjun Gill· Nov 3, 2024
azure-cost-optimization reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Kwame Agarwal· Oct 26, 2024
Useful defaults in azure-cost-optimization — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Carlos Li· Oct 22, 2024
I recommend azure-cost-optimization for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Ganesh Mohane· Oct 18, 2024
azure-cost-optimization has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Sakshi Patil· Sep 25, 2024
Solid pick for teams standardizing on skills: azure-cost-optimization is focused, and the summary matches what you get after install.
- ★★★★★William Choi· Sep 9, 2024
azure-cost-optimization is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
showing 1-10 of 33