Compartir a través de

从 EA 预留实例建议 API 迁移

以前使用 Enterprise Reporting consumption.azure.com API 获取预留实例建议的 EA 客户需要迁移到奇偶校验 Azure 资源管理器 API。 以下说明可帮助你迁移和描述旧 API 与新 API 之间的任何协定差异。

注意

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

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

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

调用预留实例建议 API

使用以下请求 URI 调用新的预留建议 API。

支持的请求

使用以下作用域调用 API:

  • 注册:providers/Microsoft.Billing/billingAccounts/{billingAccountId}
  • 订阅:subscriptions/{subscriptionId}
  • 资源组:subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}

获取建议

共享作用域和单作用域建议均可通过此 API 获得。 还可以将作用域作为可选的 API 参数进行筛选。

https://management.chinacloudapi.cn/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Consumption/reservationRecommendations?api-version=2023-05-01 

响应正文更改

在新的 API 中,共享范围和单一范围的建议合并到一个 API 中。

针对共享范围的旧响应:

{
        "lookBackPeriod": "Last60Days",
        "meterId": "00000000-0000-0000-0000-000000000000",
        "skuName": "Standard_B1s",
        "term": "P3Y",
        "region": "chinanorth3",
        "costWithNoRI": 39.773316464000011,
        "recommendedQuantity": 2,
        "totalCostWithRI": 22.502541385887369,
        "netSavings": 17.270775078112642,
        "firstUsageDate": "2024-02-23T00:00:00",
        "resourceType": "virtualmachines",
        "instanceFlexibilityRatio": 2.0,
        "instanceFlexibilityGroup": "BS Series",
        "normalizedSize": "Standard_B1ls",
        "recommendedQuantityNormalized": 4.0,
        "skuProperties": [
          {
            "name": "Cores",
            "value": "1"
          },
          {
            "name": "Ram",
            "value": "1"
          }
        ]
    },

针对单一范围的旧响应:

{
      "subscriptionId": "00000000-0000-0000-0000-000000000000",
      "lookBackPeriod": "Last60Days",
      "meterId": "00000000-0000-0000-0000-000000000000",
      "skuName": "Standard_B1s",
      "term": "P3Y",
      "region": "chinanorth3",
      "costWithNoRI": 19.892601567999996,
      "recommendedQuantity": 1,
      "totalCostWithRI": 11.252968788943683,
      "netSavings": 8.6396327790563134,
      "firstUsageDate": "2024-02-23T00:00:00",
      "resourceType": "virtualmachines",
      "instanceFlexibilityRatio": 2.0,
      "instanceFlexibilityGroup": "BS Series",
      "normalizedSize": "Standard_B1ls",
      "recommendedQuantityNormalized": 2.0,
      "skuProperties": [
        {
          "name": "Cores",
          "value": "1"
        },
        {
          "name": "Ram",
          "value": "1"
        }
      ]
}

新响应:

{
  "value": [
    {
      "id": "billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000",
      "name": "00000000-0000-0000-0000-000000000000",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "location": "chinanorth3",
      "sku": "Standard_DS1_v2",
      "kind": "legacy",
      "properties": {
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P1Y",
        "costWithNoReservedInstances": 12.0785105,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 11.4899644807748,
        "netSavings": 0.588546019225182,
        "firstUsageDate": "2019-07-07T00:00:00-07:00",
        "scope": "Shared",
        "lookBackPeriod": "Last7Days",
        "instanceFlexibilityRatio": 1,
        "instanceFlexibilityGroup": "DSv2 Series",
        "normalizedSize": "Standard_DS1_v2",
        "recommendedQuantityNormalized": 1,
        "skuProperties": [
          {
            "name": "Cores",
            "value": "1"
          },
          {
            "name": "Ram",
            "value": "1"
          }
        ]
      }
    },
   ]
}