从 EA 余额摘要 API 迁移

以前使用 Enterprise Reporting consumption.azure.com API 获取的余额摘要的 EA 客户需要迁移到替换 Azure 资源管理器 API。 以下说明可帮助你迁移和讨论旧 API 与新 API 之间的任何协定差异。

注意

所有 Azure 企业报告 API 均已停用。 你应尽快迁移到 Microsoft 成本管理 API

向服务主体分配权限以调用 API

在调用 API 之前,需要配置具有正确权限的服务主体。 使用服务主体调用 API。 有关详细信息,请参阅向成本管理 API 分配权限

调用余额摘要 API

在调用新的余额摘要 API 时,请使用以下请求 URI。 你的注册号应用作 billingAccountId

支持的请求

获取注册

https://management.chinacloudapi.cn/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances?api-version=2023-05-01

响应正文更改

旧响应正文:

{
  "id": "enrollments/100/billingperiods/201507/balancesummaries",
  "billingPeriodId": 201507,
  "currencyCode": "USD",
  "beginningBalance": 0,
  "endingBalance": 1.1,
  "newPurchases": 1,
  "adjustments": 1.1,
  "utilized": 1.1,
  "serviceOverage": 1,
  "chargesBilledSeparately": 1,
  "totalOverage": 1,
  "totalUsage": 1.1,
  "azureMarketplaceServiceCharges": 1,
  "newPurchasesDetails": [
    {
      "name": "",
      "value": 1
    }
  ],
  "adjustmentDetails": [
    {
      "name": "Promo Credit",
      "value": 1.1
    },
    {
      "name": "SIE Credit",
      "value": 1
    }
  ]
}

新响应正文:

现在,新 API 响应的属性字段中提供了相同的数据。 某些字段名称的拼写可能有细微的更改。

{
  "id": "/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/balances/balanceId1",
  "name": "balanceId1",
  "type": "Microsoft.Consumption/balances",
  "properties": {
    "currency": "USD  ",
    "beginningBalance": 3396469.19,
    "endingBalance": 2922371.02,
    "newPurchases": 0,
    "adjustments": 0,
    "utilized": 474098.17,
    "serviceOverage": 0,
    "chargesBilledSeparately": 0,
    "totalOverage": 0,
    "totalUsage": 474098.17,
    "azureMarketplaceServiceCharges": 609.82,
    "billingFrequency": "Month",
    "priceHidden": false,
    "overageRefund": 2012.61,
    "newPurchasesDetails": [
      {
        "name": "Promo Purchase",
        "value": 1
      }
    ],
    "adjustmentDetails": [
      {
        "name": "Promo Credit",
        "value": 1.1
      },
      {
        "name": "SIE Credit",
        "value": 1
      }
    ]
  }
}