如何使用 powershell 或 API 根据 VM 大小获取 Azure 托管磁盘的成本?

问题描述

我正在寻找 PowerShell cmdlet 或 API,它可以为我提供托管磁盘的成本,正如我们从 Azure 门户看到的那样

解决方法

您可以致电 Azure cost management query API 获取托管磁盘的实际成本。

在 Azure Poral 上: enter image description here

API调用请求: enter image description here 您也可以在查询数据集中使用 QueryFilter 直接得到您需要的结果。

结果: enter image description here

您也可以使用 Azure PowerShell 来执行此操作。详情见here