你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Reservation Recommendations - List

购买预留实例的建议列表。

GET https://management.azure.com/{resourceScope}/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01
GET https://management.azure.com/{resourceScope}/providers/Microsoft.Consumption/reservationRecommendations?$filter={$filter}&api-version=2024-08-01

URI 参数

名称 必需 类型 说明
resourceScope
path True

string

与预留建议作关联的范围。 这包括订阅范围的“/subscriptions/{subscriptionId}/” 资源组范围的“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}”,用于 BillingAccount 范围的“/providers/Microsoft.Billing/billingAccounts/{billingAccountId}”和“/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}”,用于 billingProfile 范围

api-version
query True

string

要用于客户端请求的 API 的版本。 当前版本为 2023-03-01。

$filter
query

string

可用于按以下方式筛选 reservationRecommendations:属性/范围,允许的值 ['Single', 'Shared'] 和默认值 'Single';属性/resourceType 中允许的值 ['VirtualMachines', “SQLDatabases”、“PostgreSQL”、“ManagedDisk”、“MySQL”、“RedHat”、“MariaDB”、“RedisCache”、“CosmosDB”、“SqlDataWarehouse”、“SUSELinux”、“AppService”、“BlockBlob”、“AzureDataExplorer”、“VMwareCloudSimple”和默认值“VirtualMachines”:和属性/lookBackPeriod,允许的值 ['Last7Days', 'Last30Days', 'Last60Days'] 和默认值 'Last7Days'。

响应

名称 类型 说明
200 OK

ReservationRecommendationsListResult

还行。 请求已成功。

204 No Content

如果没有建议,则会发送空响应。

Other Status Codes

ErrorResponse

描述作失败的原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

ReservationRecommendationsByBillingAccount-Legacy
ReservationRecommendationsByBillingAccountFilterForScope
ReservationRecommendationsByBillingProfile-Modern
ReservationRecommendationsByResourceGroup-Legacy
ReservationRecommendationsBySubscription-Legacy
ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriod-Legacy

ReservationRecommendationsByBillingAccount-Legacy

示例请求

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01

示例响应

{
  "value": [
    {
      "id": "billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000",
      "name": "00000000-0000-0000-0000-000000000000",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "location": "westus",
      "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"
          }
        ],
        "totalHours": 701,
        "lastUsageDate": "2019-08-07T00:00:00-07:00"
      }
    },
    {
      "id": "billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000",
      "name": "00000000-0000-0000-0000-000000000000",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "location": "westus",
      "sku": "Standard_DS1_v2",
      "kind": "legacy",
      "properties": {
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P1Y",
        "costWithNoReservedInstances": 10.0785105,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 13.48,
        "netSavings": 0.68,
        "firstUsageDate": "2019-07-07T00:00:00-07:00",
        "scope": "Shared",
        "lookBackPeriod": "Last7Days",
        "instanceFlexibilityRatio": 1,
        "instanceFlexibilityGroup": "DSv2 Series",
        "normalizedSize": "Standard_DS1",
        "recommendedQuantityNormalized": 1.2,
        "skuProperties": [
          {
            "name": "SkuDisplayName",
            "value": "B"
          },
          {
            "name": "CPU",
            "value": "1"
          }
        ],
        "totalHours": 805,
        "lastUsageDate": "2019-08-09T00:00:00-07:00"
      }
    }
  ],
  "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"
}

ReservationRecommendationsByBillingAccountFilterForScope

示例请求

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Consumption/reservationRecommendations?$filter=properties/scope eq 'Single'&api-version=2024-08-01

示例响应

{
  "value": [
    {
      "kind": "legacy",
      "id": "billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/71fd91a7-13b9-4ade-bb11-85cfd6422d9d",
      "name": "71fd91a7-13b9-4ade-bb11-85cfd6422d9d",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "location": "westus3",
      "sku": "Standard_B4ms",
      "properties": {
        "meterId": "9a3781ce-d0dc-5f76-99d7-29eb5aec447f",
        "term": "P1Y",
        "costWithNoReservedInstances": 0.332,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0.19474885844748857,
        "netSavings": 0.13725114155251145,
        "firstUsageDate": "2024-04-30T07:00:00Z",
        "scope": "Single",
        "lookBackPeriod": "Last7Days",
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "resourceType": "virtualmachines",
        "instanceFlexibilityRatio": 8,
        "instanceFlexibilityGroup": "BS Series High Memory",
        "normalizedSize": "Standard_B1ms",
        "recommendedQuantityNormalized": 8,
        "skuProperties": []
      }
    },
    {
      "kind": "legacy",
      "id": "billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/904b99c2-baf3-4bff-98ff-a96238ccbc96",
      "name": "904b99c2-baf3-4bff-98ff-a96238ccbc96",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "location": "westus3",
      "sku": "Standard_B4ms",
      "properties": {
        "meterId": "9a3781ce-d0dc-5f76-99d7-29eb5aec447f",
        "term": "P3Y",
        "costWithNoReservedInstances": 0.332,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0.12511415525114156,
        "netSavings": 0.20688584474885846,
        "firstUsageDate": "2024-04-30T07:00:00Z",
        "scope": "Single",
        "lookBackPeriod": "Last7Days",
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "resourceType": "virtualmachines",
        "instanceFlexibilityRatio": 8,
        "instanceFlexibilityGroup": "BS Series High Memory",
        "normalizedSize": "Standard_B1ms",
        "recommendedQuantityNormalized": 8,
        "skuProperties": []
      }
    }
  ]
}

ReservationRecommendationsByBillingProfile-Modern

示例请求

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01

示例响应

{
  "value": [
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000",
      "name": "00000000-0000-0000-0000-000000000000",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "kind": "modern",
      "properties": {
        "costWithNoReservedInstances": {
          "currency": "USD",
          "value": 279881.9457795231
        },
        "firstUsageDate": "2022-08-22T00:00:00Z",
        "instanceFlexibilityGroup": "NA",
        "instanceFlexibilityRatio": 1,
        "location": "westus2",
        "lookBackPeriod": 60,
        "meterId": "30f7049a-b092-42f4-9173-9ec31ab945ad",
        "netSavings": {
          "currency": "USD",
          "value": 153766.87728637524
        },
        "normalizedSize": "SQLDB_BC_Compute_Gen5",
        "recommendedQuantity": 35,
        "recommendedQuantityNormalized": 35,
        "resourceType": "sqldatabases",
        "scope": "Single",
        "skuName": "SQLDB_BC_Compute_Gen5",
        "skuProperties": null,
        "subscriptionId": "c6aa8a01-a744-44a7-a4f1-caad17512f27",
        "term": "P3Y",
        "totalCostWithReservedInstances": {
          "currency": "USD",
          "value": 126115.06849314792
        },
        "totalHours": 717,
        "lastUsageDate": "2022-09-22T00:00:00Z"
      }
    },
    {
      "id": "/providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000",
      "name": "00000000-0000-0000-0000-000000000000",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "kind": "modern",
      "properties": {
        "costWithNoReservedInstances": {
          "currency": "USD",
          "value": 93208.8596802244
        },
        "firstUsageDate": "2022-08-22T00:00:00Z",
        "instanceFlexibilityGroup": "NA",
        "instanceFlexibilityRatio": 1,
        "location": "westus2",
        "lookBackPeriod": 60,
        "meterId": "30f7049a-b092-42f4-9173-9ec31ab945ad",
        "netSavings": {
          "currency": "USD",
          "value": 32553.85968022456
        },
        "normalizedSize": "SQLDB_BC_Compute_Gen5",
        "recommendedQuantity": 35,
        "recommendedQuantityNormalized": 35,
        "resourceType": "sqldatabases",
        "scope": "Single",
        "skuName": "SQLDB_BC_Compute_Gen5",
        "skuProperties": null,
        "subscriptionId": "c6aa8a01-a744-44a7-a4f1-caad17512f27",
        "term": "P1Y",
        "totalCostWithReservedInstances": {
          "currency": "USD",
          "value": 60654.99999999984
        },
        "totalHours": 527,
        "lastUsageDate": "2022-08-27T00:00:00Z"
      }
    }
  ],
  "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"
}

ReservationRecommendationsByResourceGroup-Legacy

示例请求

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01

示例响应

{
  "value": [
    {
      "id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGrouups/testGroup/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1",
      "name": "reservationRecommendations1",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "sku": "Standard_DS1_v2",
      "location": "northeurope",
      "kind": "legacy",
      "properties": {
        "lookBackPeriod": "Last7Days",
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P1Y",
        "costWithNoReservedInstances": 0,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0,
        "netSavings": 4.634521202630137,
        "firstUsageDate": "2018-03-06T00:00:00Z",
        "scope": "Single",
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "totalHours": 427,
        "lastUsageDate": "2018-03-08T00:00:00Z"
      }
    },
    {
      "id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2",
      "name": "reservationRecommendations2",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "sku": "Standard_DS1_v2",
      "location": "northeurope",
      "kind": "legacy",
      "properties": {
        "lookBackPeriod": "Last7Days",
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P3Y",
        "costWithNoReservedInstances": 0,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0,
        "netSavings": 7.289315723178081,
        "firstUsageDate": "2018-03-06T00:00:00Z",
        "scope": "Single",
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "totalHours": 327,
        "lastUsageDate": "2018-03-09T00:00:00Z"
      }
    }
  ],
  "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"
}

ReservationRecommendationsBySubscription-Legacy

示例请求

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01

示例响应

{
  "value": [
    {
      "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1",
      "name": "reservationRecommendations1",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "sku": "Standard_DS1_v2",
      "location": "northeurope",
      "kind": "legacy",
      "properties": {
        "lookBackPeriod": "Last7Days",
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P1Y",
        "costWithNoReservedInstances": 0,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0,
        "netSavings": 4.634521202630137,
        "firstUsageDate": "2018-03-06T00:00:00Z",
        "scope": "Single",
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "totalHours": 827,
        "lastUsageDate": "2018-03-10T00:00:00Z"
      }
    },
    {
      "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2",
      "name": "reservationRecommendations2",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "sku": "Standard_DS1_v2",
      "location": "northeurope",
      "kind": "legacy",
      "properties": {
        "lookBackPeriod": "Last7Days",
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P3Y",
        "costWithNoReservedInstances": 0,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0,
        "netSavings": 7.289315723178081,
        "firstUsageDate": "2018-03-06T00:00:00Z",
        "scope": "Single",
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "totalHours": 927,
        "lastUsageDate": "2018-03-15T00:00:00Z"
      }
    }
  ],
  "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$skiptoken=AQAAAA%3D%3D&"
}

ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriod-Legacy

示例请求

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?$filter=properties/scope eq 'Single' AND properties/lookBackPeriod eq 'Last7Days'&api-version=2024-08-01

示例响应

{
  "value": [
    {
      "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1",
      "name": "reservationRecommendations1",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "sku": "Standard_DS1_v2",
      "location": "northeurope",
      "kind": "legacy",
      "properties": {
        "lookBackPeriod": "Last7Days",
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P1Y",
        "costWithNoReservedInstances": 0,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0,
        "netSavings": 4.634521202630137,
        "firstUsageDate": "2018-03-06T00:00:00Z",
        "scope": "Single",
        "skuProperties": [
          {
            "name": "Cores",
            "value": "1"
          },
          {
            "name": "Ram",
            "value": "1"
          }
        ],
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "totalHours": 527,
        "lastUsageDate": "2018-03-15T00:00:00Z"
      }
    },
    {
      "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2",
      "name": "reservationRecommendations2",
      "type": "Microsoft.Consumption/reservationRecommendations",
      "sku": "Standard_DS1_v2",
      "location": "northeurope",
      "kind": "legacy",
      "properties": {
        "lookBackPeriod": "Last7Days",
        "meterId": "00000000-0000-0000-0000-000000000000",
        "term": "P3Y",
        "costWithNoReservedInstances": 0,
        "recommendedQuantity": 1,
        "totalCostWithReservedInstances": 0,
        "netSavings": 7.289315723178081,
        "firstUsageDate": "2018-03-06T00:00:00Z",
        "scope": "Single",
        "skuProperties": [
          {
            "name": "SkuDisplayName",
            "value": "B"
          },
          {
            "name": "CPU",
            "value": "1"
          }
        ],
        "subscriptionId": "00000000-0000-0000-0000-000000000000",
        "totalHours": 427,
        "lastUsageDate": "2018-03-08T00:00:00Z"
      }
    }
  ],
  "nextLink": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations?api-version=2024-08-01&$filter=properties/scope+eq+'Single'+AND+properties/lookBackPeriod+eq+'Last7Days'&$skiptoken=AQAAAA%3D%3D&"
}

定义

名称 说明
amount

金额加货币。

ErrorDetails

错误的详细信息。

ErrorResponse

错误响应指示服务无法处理传入请求。 错误消息中提供了原因。

一些错误响应:

  • 429 TooManyRequests - 请求受到限制。 等待“x-ms-ratelimit-microsoft.consumption-retry-after”标头中指定的时间后重试。

  • 503 ServiceUnavailable - 服务暂时不可用。 在等待“Retry-After”标头中指定的时间后重试。

  • 504 网关超时 - 处理请求时服务超时。 尽可能减少请求中的日期范围。

LegacyReservationRecommendation

旧预留建议。

ModernReservationRecommendation

新式预留建议。

ReservationRecommendationsListResult

列出预留建议的结果。

SkuProperty

Sku 属性

amount

金额加货币。

名称 类型 说明
currency

string

金额货币。

value

number (decimal)

量。

ErrorDetails

错误的详细信息。

名称 类型 说明
code

string

错误代码。

message

string

指示作失败的原因的错误消息。

ErrorResponse

错误响应指示服务无法处理传入请求。 错误消息中提供了原因。

一些错误响应:

  • 429 TooManyRequests - 请求受到限制。 等待“x-ms-ratelimit-microsoft.consumption-retry-after”标头中指定的时间后重试。

  • 503 ServiceUnavailable - 服务暂时不可用。 在等待“Retry-After”标头中指定的时间后重试。

  • 504 网关超时 - 处理请求时服务超时。 尽可能减少请求中的日期范围。

名称 类型 说明
error

ErrorDetails

错误的详细信息。

LegacyReservationRecommendation

旧预留建议。

名称 类型 说明
etag

string

资源的 etag。

id

string

事件的完整限定 ARM ID。

kind string:

legacy

指定预留建议的类型。

location

string

资源位置

name

string

唯一标识事件的 ID。

properties.costWithNoReservedInstances

number (decimal)

不带预留实例的成本总量。

properties.firstUsageDate

string (date-time)

回首的使用情况日期。

properties.instanceFlexibilityGroup

string

实例灵活性组。

properties.instanceFlexibilityRatio

number

实例灵活性比率。

properties.lastUsageDate

string (date-time)

用于回溯计算建议的最后一个使用日期。

properties.lookBackPeriod

string

要回头查找建议的天数。

properties.meterId

string (uuid)

计量 ID (GUID)

properties.netSavings

number (decimal)

预留实例的总估计节省。

properties.normalizedSize

string

规范化大小。

properties.recommendedQuantity

number (decimal)

预留实例的建议质量。

properties.recommendedQuantityNormalized

number

建议的数量规范化。

properties.resourceType

string

Azure 资源类型。

properties.scope

string

共享或单个建议。

properties.skuProperties

SkuProperty[]

SKU 属性列表

properties.term

string

预留期限。 例如:P1M、P1Y 或 P3Y。

properties.totalCostWithReservedInstances

number (decimal)

预留实例的总成本。

properties.totalHours

integer (int32)

要支付成本的总小时数。

sku

string

资源 SKU

tags

object

资源标记。

type

string

资源类型。

ModernReservationRecommendation

新式预留建议。

名称 类型 说明
etag

string

资源的 etag。

id

string

事件的完整限定 ARM ID。

kind string:

modern

指定预留建议的类型。

location

string

资源位置

name

string

唯一标识事件的 ID。

properties.costWithNoReservedInstances

amount

不带预留实例的成本总量。

properties.firstUsageDate

string (date-time)

回首的使用情况日期。

properties.instanceFlexibilityGroup

string

实例灵活性组。

properties.instanceFlexibilityRatio

number

实例灵活性比率。

properties.lastUsageDate

string (date-time)

用于回溯计算建议的最后一个使用日期。

properties.location

string

资源位置。

properties.lookBackPeriod

integer (int32)

要回头查找建议的天数。

properties.meterId

string (uuid)

计量 ID (GUID)

properties.netSavings

amount

预留实例的总估计节省。

properties.normalizedSize

string

规范化大小。

properties.recommendedQuantity

number (decimal)

预留实例的建议质量。

properties.recommendedQuantityNormalized

number

建议的数量规范化。

properties.resourceType

string

资源类型。

properties.scope

string

共享或单个建议。

properties.skuName

string

这是 ARM Sku 名称。

properties.skuProperties

SkuProperty[]

SKU 属性列表

properties.term

string

预留期限。 例如:P1M、P1Y 或 P3Y。

properties.totalCostWithReservedInstances

amount

预留实例的总成本。

properties.totalHours

integer (int32)

要支付成本的总小时数。

sku

string

资源 SKU

tags

object

资源标记。

type

string

资源类型。

ReservationRecommendationsListResult

列出预留建议的结果。

名称 类型 说明
nextLink

string

指向下一页结果的链接(url)。

previousLink

string

指向结果上一页的链接(url)。

value ReservationRecommendation[]:

预留建议的列表。

SkuProperty

Sku 属性

名称 类型 说明
name

string

SKU 属性的名称。

value

string

SKU 属性的值。