Azure Cost Management 完全指南

数据范围
36个月
历史成本数据
实时分析
近乎实时
预算告警
支持
邮件/Webhook
Advisor
免费
优化建议

$ az costmanagement --init

如果说 AWS Cost Explorer 是 AWS 用户的"财务透镜",那么 Azure Cost Management 就是 Azure 用户掌控云成本的最佳武器。它不仅帮你看钱花在哪里,还能告诉你怎么省钱。

Azure Cost Management 是什么?

Azure Cost Management 是 Azure 原生的成本管理工具,原名"Azure Billing"和"Azure Advisor"的部分功能整合而成。它提供:

核心功能详解

1. 成本分析(Cost Analysis)

这是 Cost Management 的核心界面。你可以:

2. 预算管理(Budgets)

设置成本预算,防止"月光族"式云消费:

小技巧:你可以设置多个预算,比如按部门单独设置,便于成本分摊到各个团队。

3. 成本警报(Alerts)

Azure Cost Management 支持两种告警机制:

az consumption budget create \
  --budget-name monthly-budget \
  --amount 10000 \
  --time-grain monthly \
  --start-date 2025-05-01 \
  --alert-scope subscriptions/xxxx

4. Azure Advisor 集成

Azure Advisor 是你的"免费云优化顾问",它会定期扫描你的资源并给出优化建议:

注意: Azure Advisor 的建议基于通用规则,你需要结合自己的业务场景判断是否适用。

实战:如何用 Cost Management 发现浪费

场景一:找出空闲虚拟机

在 Cost Analysis 中,添加过滤器:

然后按 Resource 分组,查看每台 VM 的小时费用。如果某台 VM 全天费用几乎相同,可能是测试环境或者已经没人用的"僵尸机"。

场景二:优化存储层级

Azure 提供多种存储层级:

通过 Cost Management 查看存储服务费用,如果发现大量 Cool-tier 存储但访问量很低,可以考虑迁移到更低层级。

场景三:Reserved Instance 分析

对于稳定运行的 VM,Azure 提供 Reserved VM Instances(RIs):

Cost Management 会显示你的 RI 覆盖率和潜在节省空间。

Azure Cost Management API

如果需要自动化报告或集成到内部系统:

GET https://management.azure.com/subscriptions/{sub-id}/providers/Microsoft.CostManagement/query?api-version=2023-03-01

最佳实践

Azure Cost Management 让你的 Azure 云支出不再是个谜!

$ share --net https://981263.xyz/S-003-Azure-Cost-Management.html

Practical review before using this page

The S 003 Azure Cost Management resource should be read together with the rest of Cloud Cost Optimization Dashboard, not as an isolated shortcut. Before acting on the page, write down the current baseline, the assumption you are making, and the result you expect to see. This makes the page more useful for comparison and reduces the chance of changing several variables at once.

For FinOps planning, cloud cost allocation, rightsizing, tagging governance, and monthly cost review, a good review habit is to separate stable facts from estimates. Stable facts might include dates, page URLs, account names, measured values, or the exact checklist items you completed. Estimates should be labeled as estimates and revisited later. If the result affects money, health, safety, compliance, or operational risk, use the page as preparation for a more careful review rather than as the final authority.

Common mistakes to avoid

Use this page as a planning reference before changing cloud accounts. Confirm pricing, contracts, and technical limits in the relevant provider console because cloud terms can change.