Help us improve
Share bugs, ideas, or general feedback.
From amg-toolkit
Monthly Azure subscription cost analysis — lists all accessible subscriptions, lets the user choose which to analyze, then queries last billing month's cost breakdown by resource type, region, and service category for each subscription. Queries subscriptions sequentially with 1-minute waits between calls to avoid billing API rate limits (429). On first run, auto-discovers datasource UID.
npx claudepluginhub azure/amg-skills --plugin amg-toolkitHow this skill is triggered — by the user, by Claude, or both
Slash command
/amg-toolkit:amg-check-azure-spendThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
- Current UTC time: !`date -u +%Y-%m-%dT%H:%M:%SZ`
Queries Azure historical costs by service/resource/tag, forecasts spending, and suggests optimizations like rightsizing VMs or finding unused resources.
Reviews Azure cost governance, budgets, alerts, cost analysis, reservations, savings plans, tagging, exports, and FinOps ownership using official documentation and read-only evidence.
Analyzes Azure cloud costs on FinOps hubs using KQL queries in Azure Data Explorer. Handles trends, anomalies, recommendations, deployments, and operations via structured agent framework.
Share bugs, ideas, or general feedback.
date -u +%Y-%m-%dT%H:%M:%SZcat memory/amg-check-azure-spend/config.md 2>/dev/null || echo "NOT_CONFIGURED"Analyze Azure subscription costs for the last full billing month using amgmcp_cost_analysis. Queries each subscription individually with mandatory waits between calls to respect the billing API rate limit.
amgmcp_cost_analysis call, run sleep 60 via Bash before the next call. This is non-negotiable — the billing API has a tight rate limit.sleep 120), then retry. If 429 persists, wait 5 minutes (sleep 300) and retry once more. If still failing, skip that subscription and note it in the report.Update checkboxes as you complete each phase:
memory/amg-check-azure-spend/report.mdIf Config shows NOT_CONFIGURED: Run First-Run Setup at the bottom of this file, then return here.
If Config is populated: Extract the datasource UID from the pre-loaded Runtime Context above.
## Azure Monitor Datasource > UIDAlways use the last full billing month boundaries. Compute them from the "Current UTC time" in the Runtime Context above:
00:00:00.000Z (e.g., if current UTC time is 2026-04-16T..., startTime = 2026-03-01T00:00:00.000Z)00:00:00.000Z (e.g., if current UTC time is 2026-04-16T..., endTime = 2026-04-01T00:00:00.000Z)Do NOT use relative expressions like now-30d — billing months have variable lengths.
Call amgmcp_datasource_list (no parameters). Find entry with type == "grafana-azure-monitor-datasource".
memory/amg-check-azure-spend/config.md, warn user, use new UID.Call amgmcp_query_azure_subscriptions with the validated datasource UID.
Present the full list as a table:
| # | Subscription Name | Subscription ID |
|---|---|---|
| 1 | ... | ... |
If $ARGUMENTS provides subscription IDs (comma-separated): Use those directly. Validate they appear in the Phase 1b list.
If 5 or fewer subscriptions exist: Use all of them.
If more than 5 subscriptions exist: Present the list to the user and ask them to choose. Suggest a default selection of ~5 based on name (e.g., production subscriptions first). Example prompt:
"Found N subscriptions. I recommend selecting around 5 — the billing API has tight rate limits, so each subscription takes 1-3 minutes (mandatory waits + potential 429 retries). You can select more, but the run will be slow. Which subscription numbers would you like to analyze? (e.g.,
1,3,5) Or press Enter to use my suggested selection: [list]."
If the user selects more than 5: Warn them about the expected duration (roughly 2-3 minutes per subscription due to mandatory waits and 429 backoffs), then proceed if they confirm.
For each selected subscription, one at a time:
Call amgmcp_cost_analysis with:
azureMonitorDatasourceUid: {DATASOURCE_UID}
subscriptionId: {SUBSCRIPTION_ID}
startTime: {BILLING_MONTH_START}
endTime: {BILLING_MONTH_END}
Record the cost breakdown from the response:
Wait 1 minute before the next query:
sleep 60
If you receive a 429 (Too Many Requests):
sleep 120sleep 300 and retry once moreRepeat for each subscription. Do NOT proceed to the next subscription without the 1-minute wait.
Present a cost report with these sections:
State the exact billing month analyzed (e.g., "March 2026: 2026-03-01 to 2026-04-01").
| Subscription | Total Cost | Top Resource Type | Top Region | Status |
|---|---|---|---|---|
| sub-name-1 | $X,XXX.XX | Virtual Machines | East US | OK |
| sub-name-2 | $X,XXX.XX | Storage | West US 2 | OK |
For each subscription:
Based on the data, flag:
After presenting findings, save the report to memory/amg-check-azure-spend/report.md:
This file provides a baseline for future runs to compare month-over-month trends.
See ${CLAUDE_SKILL_DIR}/reference/error-handling.md for the full recovery table.
Run only when Config shows NOT_CONFIGURED. After completing, return to the Workflow above.
1. Discover Datasource UID: Call amgmcp_datasource_list. Filter type == "grafana-azure-monitor-datasource". Prefer uid == "azure-monitor-oob" if multiple match. Abort if zero match.
2. Write config: Write memory/amg-check-azure-spend/config.md:
# amg-check-azure-spend Configuration
User-specific values for the Azure spend analysis skill.
This file is auto-generated on first run and can be edited manually.
## Azure Monitor Datasource
- **UID**: {discovered_uid}
- **Name**: {discovered_name}
3. Confirm: Show the resolved config and ask for confirmation before proceeding.