/azure-cloud-development:az-cost-optimizefrom azure-cloud-development
Analyzes Azure IaC files and deployed resources for cost optimization, validates current costs, calculates priority scores, and drafts GitHub issues with recommendations.
Ships in azure-cloud-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze Azure Infrastructure-as-Code and deployed resources, transform usage and pricing evidence into prioritized cost recommendations, and output issue-ready optimization work items plus an EPIC coordination issue.
Analyze IaC files and/or resources in a target resource group; do not broaden repository scope beyond IaC.
azmcp-* over Azure CLI when available.gh CLI should be authenticated when creating issues.**/*.bicep, **/*.tf, **/main.json, and **/*template*.json.| Evidence | Preferred command or tool | Purpose |
|---|---|---|
| Best practices | azmcp-bestpractices-get | Retrieve current Azure optimization guidance before analysis. |
| Subscriptions | azmcp-subscription-list | Identify available subscriptions. |
| Resource groups | azmcp-group-list --subscription <subscription-id> | Locate candidate groups. |
| All resources | az resource list --subscription <id> --resource-group <name> | Build the resource inventory. |
| Cosmos DB | azmcp-cosmos-account-list --subscription <id> | Find accounts and throughput settings. |
| Storage | azmcp-storage-account-list --subscription <id> | Review tiering and lifecycle candidates. |
| Log Analytics | azmcp-monitor-workspace-list --subscription <id> | Find monitoring sources. |
| Key Vault | azmcp-keyvault-key-list | Inventory key vault resources when no richer MCP resource tool exists. |
| Web Apps | az webapp list | CLI fallback when no MCP tool is available. |
| App Service Plans | az appservice plan list | Identify plan SKU and scale candidates. |
| Function Apps | az functionapp list | Detect Premium to Consumption opportunities. |
| SQL Servers | az sql server list | Locate SQL Database estates for tier review. |
| Redis Cache | az redis list | Locate cache SKU and sizing candidates. |
Use IaC parsing to compare intended configuration with deployed resources. Extract SKUs, tiers, capacity, autoscale settings, retention settings, backup settings, and deployment paths before making recommendations.
Use azmcp-monitor-workspace-list --subscription <id> and azmcp-monitor-table-list --subscription <id> --workspace <name> --table-type "CustomLog" to find telemetry. Use azmcp-monitor-log-query for predefined recent and errors queries, then run targeted KQL when tables exist:
// CPU utilization for App Services
AppServiceAppLogs
| where TimeGenerated > ago(7d)
| summarize avg(CpuTime) by Resource, bin(TimeGenerated, 1h)
// Cosmos DB RU consumption
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.DOCUMENTDB"
| where TimeGenerated > ago(7d)
| summarize avg(RequestCharge) by Resource
// Storage account access patterns
StorageBlobLogs
| where TimeGenerated > ago(7d)
| summarize RequestCount=count() by AccountName, bin(TimeGenerated, 1d)
Calculate CPU and memory utilization averages, database throughput patterns, storage access frequency, and Function execution rates. Validate current monthly cost before recommendations by mapping Resource -> Current SKU -> Estimated monthly cost; use https://azure.microsoft.com/en-us/pricing/ or az billing commands as the pricing source.
Preserve strict cost terminology during analysis: Step 3 must VALIDATE CURRENT COSTS before recommendations; if estimates look wrong, re-verify pricing. Record CPU/Memory and CPU/memory evidence, each SKU/tier, any error-level logs, and whether savings are X/month, Y/month, or Z/month. If no IaC files are present, STOP. Issues may be created with create_issue after approval. Include auto-scaling and unused/redundant resource checks.
| Resource type | Cost pattern | Evidence required | Implementation hint |
|---|---|---|---|
| App Service Plans | Right-size SKU when CPU and memory are consistently low. | Plan SKU, utilization, scaling settings. | Patch Bicep/Terraform first; use az appservice plan update --name <plan> --sku <sku> only when no IaC exists. |
| Function Apps | Move Premium to Consumption for low or bursty workloads. | Execution count, cold-start tolerance, VNet and always-on needs. | Confirm feature compatibility before changing plan. |
| Virtual Machines | Scale down oversized instances or schedule non-production shutdown. | CPU, memory, disk, business hours. | Document expected downtime and rollback. |
| Cosmos DB | Move provisioned to serverless or right-size RU/s. | RequestCharge, provisioned RU/s, peak windows. | Preserve availability and consistency requirements. |
| SQL Database | Right-size service tier based on DTU/vCore usage. | DTU/vCore utilization, storage, HA needs. | Test non-production and monitor latency. |
| Storage | Apply Hot -> Cool -> Archive lifecycle policies. | Access patterns from StorageBlobLogs. | Use lifecycle management through IaC. |
| Redundant resources | Remove unused or duplicate resources. | No usage, no dependencies, owner confirmation. | Open a removal issue; require explicit approval. |
| Non-production environments | Schedule shutdown or autoscale. | Environment tags and working hours. | Avoid production and shared resources. |
Compute priority for each recommendation:
Priority Score = (Value Score × Monthly Savings) / (Risk Score × Implementation Days)
High Priority: Score > 20
Medium Priority: Score 5-20
Low Priority: Score < 5
Every savings estimate must show current validated cost, target cost, monthly savings, pricing source, implementation risk, and prerequisites.
azmcp-bestpractices-get and keep cited best-practice evidence with the analysis.**/*.bicep, **/*.tf, **/main.json, **/*template*.json; stop if none are found.cost-optimization and azure only after approval.cost-optimization, azure, and epic after individual issues exist.Individual issue title:
[COST-OPT] [Resource Type] - [Brief Description] - $X/month savings
Individual issue body:
## Cost Optimization: [Brief Title]
**Monthly Savings**: $X | **Risk Level**: [Low/Medium/High] | **Implementation Effort**: X days
### Description
[Clear explanation of the optimization and why it's needed]
### Implementation
**IaC Files Detected**: [Yes/No - based on file_search results]
```bash
# If IaC files found: show IaC modifications and deployment
# File: infrastructure/bicep/modules/app-service.bicep
# Change: sku.name: 'S3' -> 'B2'
az deployment group create --resource-group [rg] --template-file infrastructure/bicep/main.bicep
# If no IaC files: direct Azure CLI commands plus warning
# No IaC files found. If they exist elsewhere, modify those instead.
az appservice plan update --name [plan] --sku B2
Priority Score: X | Value: X/10 | Risk: X/10
EPIC issue title:
```text
[EPIC] Azure Cost Optimization Initiative - $X/month potential savings
EPIC issue body:
# Azure Cost Optimization EPIC
**Total Potential Savings**: $X/month | **Implementation Timeline**: X weeks
## Executive Summary
- **Resources Analyzed**: X
- **Optimization Opportunities**: Y
- **Total Monthly Savings Potential**: $X
- **High Priority Items**: N
## Current Architecture Overview
```mermaid
graph TB
subgraph "Resource Group: [name]"
[Generated architecture diagram showing current resources and costs]
end
Verify Mermaid syntax and use accessible labels and colors if styling is added.
## Troubleshooting
| Symptom | Likely cause | Resolution |
| --- | --- | --- |
| Savings estimate lacks evidence | Pricing source, SKU, or usage metric is missing. | Re-verify configuration and pricing before recommending. |
| Azure authentication fails | MCP or CLI profile is not authenticated. | Provide manual Azure CLI setup steps and stop resource discovery. |
| No resources found | Wrong subscription/resource group or no deployment. | Create an informational issue only if approved. |
| GitHub issue creation fails | Missing GitHub auth or repository target. | Output the formatted recommendations to console. |
| Usage data is insufficient | Monitoring tables are absent or retention is too short. | Mark recommendations as configuration-based only. |
## Output template
```markdown
## Azure cost optimization summary
**Status:** ready for approval | issues created | blocked
**Resources analyzed:** <count>
**Current monthly cost:** $<amount>
**Potential monthly savings:** $<amount>
**Optimization opportunities:** <count>
**High priority items:** <count>
| Resource | Current SKU/config | Target SKU/config | Monthly savings | Risk | Effort | Priority score | Evidence |
| --- | --- | --- | --- | --- | --- | --- | --- |
| <name> | <current> | <target> | $<amount> | Low/Medium/High | <days> | <score> | <pricing and usage source> |
**Issues**
- Individual issues: <created count or issue-ready markdown>
- EPIC issue: <created issue or issue-ready markdown>
**Validation**
- IaC scan: <patterns scanned and result>
- Cost validation: <pricing source>
- User confirmation: <approved/not requested/non-interactive>
azmcp-bestpractices-get was used or an unavailable-tool limitation was reported.**/*.bicep, **/*.tf, **/main.json, **/*template*.json.What SKILL.md sets; muted values are Claude Code's defaults
12 skills in this plugin
/azure-cliAzure CLI operations run az commands for cloud resource discovery, subscription context, identity, AKS, ACR, Key Vault, RBAC, managed identity, and federated credential workflows. Use this skill when working with az login, az account, az aks, az acr, az keyvault, resource group checks, or Azure day-2 operations./azure-computeRoute Azure virtual machine and scale set work, including size and image selection, pricing comparison, autoscale and orchestration modes, capacity reservation groups, and Essential Machine Management. Use when the user asks to create, provision, deploy, or spin up a VM, recommend a VM size or family, compare VM pricing, work with VMSS, scale sets, autoscale, burstable or GPU sizes, plan HPC, machine learning, or dev/test workloads, estimate compute cost, or reserve and guarantee capacity./azure-enterprise-infra-plannerArchitect and provision enterprise Azure infrastructure from workload descriptions for cloud architects and platform engineers, covering networking, identity, security, compliance, and multi-resource topologies with Well-Architected alignment, and generating Bicep or Terraform directly without azd. Use when the user asks to plan Azure infrastructure, architect a landing zone, design a hub-spoke network, plan a multi-region disaster recovery topology, set up virtual networks, firewalls, and private endpoints, run a subscription-scope Bicep deployment, or configure Azure Backup for VM workloads.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin azure-cloud-developmentOther plugins' skills for the same job