azure-cost
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAzure Cost Management Skill
Azure 成本管理技能
Unified skill for all Azure cost management tasks: querying historical costs, forecasting future spending, and optimizing to reduce waste.
适用于所有Azure成本管理任务的统一技能:查询历史成本、预测未来支出、优化以减少浪费。
When to Use This Skill
何时使用该技能
Activate this skill when user wants to:
- Query or analyze Azure costs (how much am I spending, show my bill, cost breakdown)
- Break down costs by service, resource, location, or tag
- Analyze cost trends over time
- Forecast future Azure spending or project end-of-month costs
- Optimize Azure costs, reduce spending, or find savings
- Find orphaned or unused resources
- Rightsize Azure VMs, containers, or services
- Generate cost optimization reports
当用户需要完成以下操作时激活该技能:
- 查询或分析Azure成本(我的支出是多少、查看我的账单、成本明细)
- 按服务、资源、地域或标签拆分成本
- 分析不同时间段的成本趋势
- 预测未来Azure支出或估算月末成本
- 优化Azure成本、减少支出或寻找节约空间
- 查找孤立或未使用的资源
- 对Azure VM、容器或服务进行规格优化
- 生成成本优化报告
Quick Reference
快速参考
| Property | Value |
|---|---|
| Query API Endpoint | |
| Forecast API Endpoint | |
| MCP Tools | |
| CLI | |
| Required Role | Cost Management Reader + Monitoring Reader + Reader on scope |
| 属性 | 值 |
|---|---|
| 查询API端点 | |
| 预测API端点 | |
| MCP工具 | |
| CLI | |
| 所需角色 | 成本管理读取者 + 监控读取者 + 对应范围的读取权限 |
MCP Tools
MCP工具
| Tool | Description | Parameters | When to Use |
|---|---|---|---|
| Search Azure documentation | | Research Cost Management API parameters and options |
| Generate Azure CLI commands | | Construct |
| Get Azure best practices | | Inform query design with cost management best practices |
| Run Azure Quick Review compliance scan | | Find orphaned resources and cost optimization opportunities |
| Azure Kubernetes Service operations | varies by sub-command | AKS cost analysis: list clusters, get node pools, inspect configuration |
💡 Tip: Prefer MCP tools over direct CLI commands. Useonly when MCP tools don't cover the specific operation.az rest
| 工具 | 描述 | 参数 | 使用场景 |
|---|---|---|---|
| 搜索Azure文档 | | 调研成本管理API的参数和可选配置 |
| 生成Azure CLI命令 | | 构造用于成本查询的 |
| 获取Azure最佳实践 | | 结合成本管理最佳实践设计查询逻辑 |
| 运行Azure快速审核合规扫描 | | 查找孤立资源和成本优化机会 |
| Azure Kubernetes Service操作 | 随子命令变化 | AKS成本分析:列出集群、获取节点池、查看配置 |
💡 提示: 优先使用MCP工具而非直接执行CLI命令。仅当MCP工具不覆盖特定操作时使用。az rest
Routing
路由
Read the user's request and follow the appropriate workflow below.
| User Intent | Workflow | Example Prompts |
|---|---|---|
| Understand current costs | Cost Query Workflow | "how much am I spending", "cost by service", "show my bill" |
| Reduce costs / find waste | Cost Optimization Workflow | "optimize costs", "find orphaned resources", "reduce spending" |
| Project future costs | Cost Forecast Workflow | "forecast costs", "end of month estimate", "how much will I spend" |
| Full cost picture | All three workflows combined | "give me the full picture of my Azure costs" |
Important: When optimizing costs, always present the total bill and cost breakdown alongside optimization recommendations.
读取用户请求,遵循对应工作流处理:
| 用户意图 | 工作流 | 示例提示 |
|---|---|---|
| 了解当前成本 | 成本查询工作流 | "我的支出是多少", "按服务拆分成本", "查看我的账单" |
| 降低成本/查找浪费 | 成本优化工作流 | "优化成本", "查找孤立资源", "减少支出" |
| 预估未来成本 | 成本预测工作流 | "预测成本", "月末估算", "我将支出多少" |
| 完整成本视图 | 组合三个工作流 | "给我展示Azure成本的完整情况" |
重要提示: 做成本优化时,始终在给出优化建议的同时展示总账单和成本明细。
Scope Reference (Shared Across All Workflows)
范围参考(所有工作流通用)
| Scope | URL Pattern |
|---|---|
| Subscription | |
| Resource Group | |
| Management Group | |
| Billing Account | |
| Billing Profile | |
💡 Tip: These are scope paths only — not complete URLs. Combine with the API endpoint and version.
| 范围 | URL格式 |
|---|---|
| 订阅 | |
| 资源组 | |
| 管理组 | |
| 计费账户 | |
| 计费配置文件 | |
💡 提示: 以上仅为范围路径,不是完整URL。需要与API端点和版本拼接使用。
Part 1: Cost Query Workflow
第一部分:成本查询工作流
For the full cost query workflow (scope selection, report types, timeframes, dataset configuration, API calls, pagination, guardrails, examples, and error handling), see:
📄 Cost Query Workflow
完整的成本查询工作流(范围选择、报告类型、时间范围、数据集配置、API调用、分页、防护规则、示例和错误处理)请查看:
📄 成本查询工作流
Part 2: Cost Optimization Workflow
第二部分:成本优化工作流
For the full cost optimization workflow (prerequisites, best practices, Redis/AKS-specific analysis, Azure Quick Review, resource discovery, cost queries, pricing validation, utilization metrics, and report generation), see:
📄 Cost Optimization Workflow
完整的成本优化工作流(前置条件、最佳实践、Redis/AKS专属分析、Azure快速审核、资源发现、成本查询、定价校验、使用率指标和报告生成)请查看:
📄 成本优化工作流
Part 3: Cost Forecast Workflow
第三部分:成本预测工作流
For the full cost forecast workflow (scope selection, time period rules, dataset configuration, forecast-specific options, API calls, response interpretation, guardrails, and error handling), see:
📄 Cost Forecast Workflow
完整的成本预测工作流(范围选择、时间周期规则、数据集配置、预测专属选项、API调用、响应解析、防护规则和错误处理)请查看:
📄 成本预测工作流
Data Classification
数据分类
- ACTUAL DATA = Retrieved from Azure Cost Management API
- ACTUAL METRICS = Retrieved from Azure Monitor
- VALIDATED PRICING = Retrieved from official Azure pricing pages
- ESTIMATED SAVINGS = Calculated based on actual data and validated pricing
- 实际数据 = 从Azure成本管理API获取
- 实际指标 = 从Azure Monitor获取
- 已校验定价 = 从Azure官方定价页面获取
- 预估节约金额 = 基于实际数据和已校验定价计算得出
Best Practices
最佳实践
- Always query actual costs first — never estimate or assume
- Always present the total bill alongside optimization recommendations
- Validate pricing from official sources — account for free tiers
- Use REST API for cost queries (more reliable than )
az costmanagement query - Save audit trail — include all queries and responses
- Include Azure Portal links for all resources
- For costs < $10/month, emphasize operational improvements over financial savings
- Never execute destructive operations without explicit approval
- 始终优先查询实际成本——绝不估算或假设
- 始终在给出优化建议的同时展示总账单
- 从官方来源校验定价——考虑免费 tier 的影响
- 使用REST API查询成本(比更可靠)
az costmanagement query - 留存审计轨迹——包含所有查询和响应
- 所有资源都附带Azure Portal链接
- 对于月成本低于10美元的资源,优先强调运营改进而非财务节约
- 没有明确批准的情况下绝不执行破坏性操作
Common Pitfalls
常见陷阱
- Assuming costs: Always query actual data from Cost Management API
- Ignoring free tiers: Many services have generous allowances
- Using wrong date ranges: 30 days for costs, 14 days for utilization
- Not showing the bill: Always present cost breakdown alongside optimization recommendations
- Cost query failures: Use with JSON body, not
az restaz costmanagement query
- 假设成本:始终从成本管理API查询实际数据
- 忽略免费 tier:很多服务有 generous 的使用额度
- 使用错误的日期范围:成本查询取30天数据,使用率查询取14天数据
- 不展示账单:始终在给出优化建议的同时展示成本明细
- 成本查询失败:使用带JSON请求体的,不要用
az restaz costmanagement query
Safety Requirements
安全要求
- Get approval before deleting resources
- Test changes in non-production first
- Provide dry-run commands for validation
- Include rollback procedures
- 删除资源前必须获得审批
- 先在非生产环境测试变更
- 提供试运行命令用于校验
- 包含回滚流程
SDK Quick References
SDK快速参考
- Redis Management: .NET
- Redis管理:.NET