Skip to content
Back to skills

Apex Azure Cost Optimization

ASecurity

**ANALYSIS SKILL** — Query, forecast and optimize Azure costs via cost + utilization analysis. WHEN: "optimize Azure costs", "find cost savings", "what did we spend", "cost forecast", "rightsize VMs", "find orphaned resources", "optimize Redis costs". DO NOT USE FOR: deploying (apex-azure-deploy), general diagnostics (apex-azure-diagnostics), security issues (apex-azure-compliance).

  • 216 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 24, 2026
ai-agentsazureapisecurity

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned September 24, 2026

npx -y skills add jonathan-vella/apex --skill apex-azure-cost-optimization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Apex Azure Cost Optimization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Apex Azure Cost Optimization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jonathan-vella-apex-azure-cost-optimization/badge)](https://www.skillsdirectory.com/skills/jonathan-vella-apex-azure-cost-optimization)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: apex-azure-cost-optimization
user-invocable: true
disable-model-invocation: false
argument-hint: "subscription scope and analysis period"
description: '**ANALYSIS SKILL** — Query, forecast and optimize Azure costs via cost + utilization analysis. WHEN: "optimize Azure costs", "find cost savings", "what did we spend", "cost forecast", "rightsize VMs", "find orphaned resources", "optimize Redis costs". DO NOT USE FOR: deploying (apex-azure-deploy), general diagnostics (apex-azure-diagnostics), security issues (apex-azure-compliance).'
license: MIT
metadata:
  author: Microsoft
  version: "1.0.0"
---

# Azure Cost Optimization Skill

Analyze Azure subscriptions to identify cost savings through orphaned resource cleanup, rightsizing, and optimization recommendations based on actual usage data.

## Routing

| User intent                           | Workflow                                                          |
| ------------------------------------- | ----------------------------------------------------------------- |
| Understand current or historical cost | [Cost query](references/cost-query/workflow.md) (`query_costs`)    |
| Reduce costs or find waste            | [Instructions](#instructions) below                               |
| Project future cost                   | [Cost forecast](references/cost-forecast/workflow.md) (`forecast_costs`) |

## Scope Reference (Shared Across All Workflows)

- Subscription: `/subscriptions/<id>`
- Resource group: `/subscriptions/<id>/resourceGroups/<name>`
- Management group: `/providers/Microsoft.Management/managementGroups/<id>`
- Billing account: `/providers/Microsoft.Billing/billingAccounts/<id>`

## 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](./references/azure-redis.md) for Redis-specific analysis
- **Review storage tiers and lifecycle** - See [Azure Storage Cost Review](./references/azure-storage-tiers.md)

## Rules

- **Read-only analysis first** — never delete or modify resources during the assessment phase; remediation is a separate user-approved step
- **Validate prerequisites** before starting (Azure CLI authenticated, `costmanagement` + `resource-graph` extensions, `azqr` installed, Cost Management Reader + Monitoring Reader + Reader roles)
- **Use real data** — recommendations must be grounded in actual cost queries and utilization metrics, not assumptions
- **ARM MCP first** — use API fallbacks only when an operation is unavailable, never to bypass invalid input, denied access, throttling or empty data ([tool and safety guidance](references/tools-and-safety.md))
- **Cite sources** — every savings estimate must reference the underlying cost query or pricing API result (audit trail in `agent-output/{project}/cost-query-result<timestamp>.json`)
- **Classify safely** — mark recommendations as Safe / Review / Risky; never auto-apply destructive operations
- **Show the total bill** — present savings next to the scope's total actual cost for the same period, so each saving reads against the whole bill
- **Redis-specific scope** — when the user asks about Redis only, follow [Azure Redis Cost Optimization](./references/azure-redis.md) instead of the general subscription workflow
- **Save artifacts** to `agent-output/{project}/costoptimizereport<timestamp>.md` and the audit trail JSON; without a project, ask for its name before writing
- **Out of scope**: deploying resources (use `apex-azure-deploy`), security issues (use `apex-azure-compliance`), general diagnostics (use `apex-azure-diagnostics`)

## Instructions

High-level step list (full procedure in
[`references/workflow-steps.md`](./references/workflow-steps.md)):

|   # | Step                                                                                           | Reference                                                               |
| --: | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
|   0 | Validate prerequisites (Azure CLI, `costmanagement` + `resource-graph` extensions, azqr, RBAC) | [`workflow-steps.md`](./references/workflow-steps.md)                   |
|   1 | Load Azure cost-optimization best practices via `mcp_azure-mcp_get_azure_bestpractices`        | [`workflow-steps.md`](./references/workflow-steps.md)                   |
| 1.5 | (Conditional) Redis-specific analysis branch                                                   | [`azure-redis.md`](./references/azure-redis.md)                         |
| 1.6 | (Redis branch) Choose analysis scope (subscription / prefix / tenant-wide)                     | [`azure-redis.md`](./references/azure-redis.md)                         |
|   2 | Run Azure Quick Review (`extension_azqr`) for orphaned-resource discovery                      | [`azure-quick-review.md`](./references/azure-quick-review.md)           |
|   3 | Discover resources cross-subscription via Azure Resource Graph                                 | [`azure-resource-graph.md`](./references/azure-resource-graph.md)       |
| 4–9 | Cost queries, pricing validation, metrics, report, audit trail, cleanup                        | [`detailed-workflow-steps.md`](./references/detailed-workflow-steps.md) |

> **Branching rule**: use Redis-only analysis only for an explicitly Redis-only request.
> Mixed-service or subscription-wide requests retain the general workflow and add
> Redis analysis for those resources. An ambiguous Redis mention never narrows scope;
> clarify intent while preserving all requested services.

## Output

The skill generates:

1. **Cost Optimization Report** (`agent-output/{project}/costoptimizereport<timestamp>.md`)
   - Executive summary with total costs and top drivers
   - Detailed cost breakdown with Azure Portal links
   - Prioritized recommendations with actual data and estimated savings
   - Implementation commands with safety warnings

2. **Cost Query Results** (`agent-output/{project}/cost-query-result<timestamp>.json`)
   - Audit trail of all cost queries and responses
   - Validation evidence for recommendations

## Important Notes

📋 **Reference**: Read `references/best-practices-notes.md` for data classification labels, best practices, common pitfalls, and safety requirements.

## SDK Quick References

- **Redis Management**: [.NET](references/sdk/azure-resource-manager-redis-dotnet.md)

## Reference Index

Load these on demand — do NOT read all at once:

| Reference                               | When to Load                                                       |
| --------------------------------------- | ------------------------------------------------------------------ |
| `../apex-entra-app-registration/references/auth-best-practices.md` | Auth Best Practices                                                |
| `references/azure-quick-review.md`      | Azure Quick Review                                                 |
| `references/azure-redis.md`             | Azure Redis                                                        |
| `references/azure-resource-graph.md`    | Azure Resource Graph                                               |
| `references/workflow-steps.md`          | Steps 0–3: prerequisites, best practices, azqr, resource discovery |
| `references/detailed-workflow-steps.md` | Steps 4-9: cost queries, pricing, metrics, report, audit, cleanup  |
| `references/best-practices-notes.md`    | Data classification, best practices, pitfalls, safety              |
| `references/cost-query/workflow.md`     | Cost breakdowns, trends and totals; `query_costs` limits and errors |
| `references/cost-forecast/workflow.md`  | Forecasts; `forecast_costs` period and row limits                  |
| `references/tools-and-safety.md`        | ARM MCP fallback APIs, evidence labels and approval rules          |
| `references/azure-storage-tiers.md`     | Storage access tiers, lifecycle tiering and review signals         |

Files in this skill

  • SKILL.md8.1 KB
  • references/azure-quick-review.md1.6 KB
  • references/azure-redis.md3.8 KB
  • references/azure-resource-graph.md2.8 KB
  • references/azure-storage-tiers.md6.6 KB
  • references/best-practices-notes.md1.7 KB
  • references/cost-forecast/error-handling.md1.4 KB
  • references/cost-forecast/examples.md772 B
  • references/cost-forecast/guardrails.md913 B
  • references/cost-forecast/request-body-schema.md1018 B
  • references/cost-forecast/workflow.md2.2 KB
  • references/cost-query/dimensions-by-scope.md1.5 KB
  • references/cost-query/error-handling.md1.5 KB
  • references/cost-query/examples.md1.3 KB
  • references/cost-query/guardrails.md1.7 KB
  • references/cost-query/request-body-schema.md1.4 KB
  • references/cost-query/workflow.md2.8 KB
  • references/detailed-workflow-steps.md6.8 KB
  • references/sdk/azure-resource-manager-redis-dotnet.md1.6 KB
  • references/tools-and-safety.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.