cost-optimization
Cost Optimization
Identify what to right-size, what to clean up, and what new commitments to consider. Right-sizing recommendations are filtered against Azure Policy SKU restrictions and flagged for overlap with existing reservations / savings plans, so recommendations don't fight existing commitments.
This skill uses cost data, Azure Advisor recommendations, and ARG inventory/configuration only — apply utilization-based recommendations with normal change-control review.
All ARG queries below take subscription-id placeholders (
<sub-id-1>, <sub-id-2>) — replace with the target subscriptions. To target a management group, first resolve member subs viaResourceContainers | where type == 'microsoft.resources/subscriptions' | where properties.managementGroupAncestorsChain has '<mg-name>' | project subscriptionId.
Run every ARG query through the generate → validate → execute workflow. The queries below are ready to run, but pass each one to
validate_queryfirst — it confirms the syntax and property paths before you spend a call onexecute_query. If you need to adapt a query to a different resource type or field, draft it withgenerate_query(a natural-language prompt), then validate and execute.
Step 1: Top Cost Contributors
Call query_costs with timeframe=MonthToDate, groupBy=ServiceName,ResourceGroupName. Identify the top 5–10 cost drivers — these are where optimization effort pays off.
Multi-currency caveat: at management-group or billing-account scope, the result may contain multiple
Currencyvalues. Rank contributors per currency — don't combine USD and GBP into one number.
Blob storage shortcut: if Storage (
ServiceName= "Storage") is among the top contributors, recommend enabling smart tier on the account(s) — it automatically moves blobs between access tiers based on usage to reduce cost. Point the user to Optimize Azure Blob Storage costs with smart tier. Surface this as a recommendation and link only — don't estimate the savings.