无法获取Azure账单帐户ID

时间:2020-07-17 11:16:24

标签: azure azure-active-directory billing azure-billing-api cost-management

首先,我需要使用this API来获取“计费帐户范围”的“使用情况详细信息”,但是它返回一个空值。我使用Bearer Access令牌访问了此API。除了此以外,我还错过了其他什么吗?

Postman Request attached as screenshot

Postman Request attached as screenshot

1 个答案:

答案 0 :(得分:2)

我相信您使用的API错误。要获取帐单信息,您必须提供帐单帐户名称:

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}?api-version=2019-10-01-preview

https://docs.microsoft.com/en-us/rest/api/billing/2019-10-01-preview/billingaccounts/get

PS:您可以使用“尝试”并测试它是否会返回您所需的信息。

您还可以查询使用率API并使用可用的维度之一来获取与费用相关的信息:

POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/query?api-version=2019-11-01

https://docs.microsoft.com/en-us/rest/api/cost-management/query/usage