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

Reservation Recommendation Details - Get

预留实例的 What-if 分析的预留建议的详细信息。

GET https://management.azure.com/{resourceScope}/providers/Microsoft.Consumption/reservationRecommendationDetails?api-version=2023-05-01&scope={scope}&region={region}&term={term}&lookBackPeriod={lookBackPeriod}&product={product}
GET https://management.azure.com/{resourceScope}/providers/Microsoft.Consumption/reservationRecommendationDetails?api-version=2023-05-01&scope={scope}&region={region}&term={term}&lookBackPeriod={lookBackPeriod}&product={product}&$filter={$filter}

URI 参数

名称 必需 类型 说明
resourceScope
path True

string

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

api-version
query True

string

要与客户端请求一起使用的 API 的版本。 当前版本为 2023-03-01。

lookBackPeriod
query True

lookBackPeriod

筛选预留建议结果所基于的时间段。

product
query True

string

筛选生成预留建议结果的产品。 示例:VM) 的Standard_DS1_v2 (、适用于 托管磁盘) 的 Premium_SSD_Managed_Disks_P30 (

region
query True

string

用于选择应为其生成建议的区域。

scope
query True

scope

预留的范围。

term
query True

term

指定预留建议期限的长度。

$filter
query

string

用于按以下方式筛选预留建议详细信息:可以为计费帐户和计费配置文件路径指定 properties/subscriptionId。

响应

名称 类型 说明
200 OK

ReservationRecommendationDetailsModel

没问题。 请求已成功。

204 No Content

如果没有建议详细信息,则会发送空响应。

Other Status Codes

HighCasedErrorResponse

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

安全性

azure_auth

Azure Active Directory OAuth2 流。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

ReservationRecommendationsByBillingAccount-Legacy
ReservationRecommendationsByBillingProfile-Modern
ReservationRecommendationsByResourceGroup-Legacy
ReservationRecommendationsBySubscription-Legacy

ReservationRecommendationsByBillingAccount-Legacy

Sample Request

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/00000000/providers/Microsoft.Consumption/reservationRecommendationDetails?api-version=2023-05-01&scope=Shared&region=eastus&term=P1Y&lookBackPeriod=Last60Days&product=Standard_DS14_v2&$filter=properties/subscriptionId eq 00000000-0000-0000-0000-00000000

Sample Response

{
  "id": "providers/Microsoft.Billing/billingAccounts/00000000/providers/microsoft.consumption/reservationrecommendationdetails",
  "name": "reservationRecommendationDetails",
  "type": "Microsoft.Consumption/ReservationRecommendationDetails",
  "properties": {
    "currency": "USD",
    "resource": {
      "appliedScopes": [
        "00000000-0000-0000-0000-00000000",
        "00000000-0000-0000-0000-00000000"
      ],
      "onDemandRate": 1.482,
      "product": "Standard_DS14_v2",
      "region": "eastus",
      "reservationRate": 0.70570776255707,
      "resourceType": "virtualmachines"
    },
    "resourceGroup": null,
    "savings": {
      "calculatedSavings": [
        {
          "onDemandCost": 529550.326618951,
          "overageCost": 63253.5935111345,
          "quantity": 220,
          "reservationCost": 223102.452054792,
          "totalReservationCost": 286356.045565927,
          "savings": 243194.281053024
        },
        {
          "onDemandCost": 529550.32661895,
          "overageCost": 149335.025050147,
          "quantity": 179,
          "reservationCost": 181524.267808217,
          "totalReservationCost": 330859.292858364,
          "savings": 198691.033760586
        },
        {
          "onDemandCost": 529550.32661895,
          "overageCost": 195942.319606957,
          "quantity": 157,
          "reservationCost": 159214.022602738,
          "totalReservationCost": 355156.342209695,
          "savings": 174393.984409255
        },
        {
          "onDemandCost": 529550.32661895,
          "overageCost": 30975.2311896299,
          "quantity": 241,
          "reservationCost": 244398.595205477,
          "totalReservationCost": 275373.826395107,
          "savings": 254176.500223843
        }
      ],
      "lookBackPeriod": 60,
      "recommendedQuantity": 253,
      "reservationOrderTerm": "P1Y",
      "savingsType": "instance",
      "unitOfMeasure": "hour"
    },
    "scope": "Shared",
    "usage": {
      "firstConsumptionDate": "2019-11-27T00:00:00",
      "lastConsumptionDate": "2020-01-25T21:00:00",
      "lookBackUnitType": "virtualMachine quantity",
      "usageData": [
        275.95003899999995,
        275.916705,
        276,
        276,
        275.916725,
        275.916705,
        275.98335299999997,
        276,
        276,
        276,
        276,
        276,
        275.98335299999997,
        276,
        276,
        276,
        276,
        275.933352
      ],
      "usageGrain": "hourly"
    }
  }
}

ReservationRecommendationsByBillingProfile-Modern

Sample Request

GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-00000000:00000000-0000-0000-0000-00000000/billingProfiles/00000000-0000-0000-0000-00000000/providers/Microsoft.Consumption/reservationRecommendationDetails?api-version=2023-05-01&scope=Shared&region=australiaeast&term=P1Y&lookBackPeriod=Last7Days&product=Standard_B2s&$filter=properties/subscriptionId eq 00000000-0000-0000-0000-00000000

Sample Response

{
  "id": "providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-00000000:00000000-0000-0000-0000-00000000/billingProfiles/00000000-0000-0000-0000-00000000/providers/microsoft.consumption/reservationrecommendationdetails",
  "name": "reservationRecommendationDetails",
  "type": "Microsoft.Consumption/ReservationRecommendationDetails",
  "properties": {
    "currency": "AUD",
    "resource": {
      "appliedScopes": [
        "00000000-0000-0000-0000-00000000"
      ],
      "onDemandRate": 0.0725,
      "product": "Standard_B2s",
      "region": "australiaeast",
      "reservationRate": 0.04414166531788041,
      "resourceType": "virtualmachines"
    },
    "resourceGroup": null,
    "savings": {
      "calculatedSavings": [
        {
          "onDemandCost": 632.8844720496894,
          "overageCost": 0,
          "quantity": 1,
          "reservationCost": 387.74038815226174,
          "totalReservationCost": 387.74038815226174,
          "savings": 245.1440838974277
        }
      ],
      "lookBackPeriod": 7,
      "recommendedQuantity": 1,
      "reservationOrderTerm": "P1Y",
      "savingsType": "instance",
      "unitOfMeasure": "hour"
    },
    "scope": "Shared",
    "usage": {
      "firstConsumptionDate": "2020-01-19T00:00:00",
      "lastConsumptionDate": "2020-01-25T17:00:00",
      "lookBackUnitType": "virtualMachine quantity",
      "usageData": [
        1,
        1,
        1,
        1,
        1,
        1,
        1,
        1,
        1,
        0
      ],
      "usageGrain": "hourly"
    }
  }
}

ReservationRecommendationsByResourceGroup-Legacy

Sample Request

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/testGroup/providers/Microsoft.Consumption/reservationRecommendationDetails?api-version=2023-05-01&scope=Single&region=westus&term=P3Y&lookBackPeriod=Last30Days&product=Standard_DS13_v2

Sample Response

{
  "id": "subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/testGroup/providers/microsoft.consumption/reservationrecommendationdetails",
  "name": "reservationRecommendationDetails",
  "type": "Microsoft.Consumption/ReservationRecommendationDetails",
  "properties": {
    "currency": "USD",
    "resource": {
      "appliedScopes": [
        "00000000-0000-0000-0000-00000000",
        "testGroup"
      ],
      "onDemandRate": 0.519,
      "product": "Standard_DS13_v2",
      "region": "westus",
      "reservationRate": 0.302549467275493,
      "resourceType": "virtualmachines"
    },
    "resourceGroup": "testGroup",
    "savings": {
      "calculatedSavings": [
        {
          "onDemandCost": 368.4813602070006,
          "overageCost": 0,
          "quantity": 2,
          "reservationCost": 429.01514459665,
          "totalReservationCost": 429.01514459665,
          "savings": -60.5337843896494
        },
        {
          "onDemandCost": 368.481360207,
          "overageCost": 1.557,
          "quantity": 1,
          "reservationCost": 214.507572298325,
          "totalReservationCost": 216.064572298325,
          "savings": 152.416787908675
        }
      ],
      "lookBackPeriod": 30,
      "recommendedQuantity": 1,
      "reservationOrderTerm": "P3Y",
      "savingsType": "instance",
      "unitOfMeasure": "hour"
    },
    "scope": "Single",
    "usage": {
      "firstConsumptionDate": "2020-02-03T00:00:00",
      "lastConsumptionDate": "2020-03-03T13:00:00",
      "lookBackUnitType": "virtualMachine quantity",
      "usageData": [
        1,
        1,
        1,
        1,
        1,
        1
      ],
      "usageGrain": "hourly"
    }
  }
}

ReservationRecommendationsBySubscription-Legacy

Sample Request

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000/providers/Microsoft.Consumption/reservationRecommendationDetails?api-version=2023-05-01&scope=Single&region=westus&term=P3Y&lookBackPeriod=Last30Days&product=Standard_DS13_v2

Sample Response

{
  "id": "subscriptions/00000000-0000-0000-0000-00000000/providers/microsoft.consumption/reservationrecommendationdetails",
  "name": "reservationRecommendationDetails",
  "type": "Microsoft.Consumption/ReservationRecommendationDetails",
  "properties": {
    "currency": "USD",
    "resource": {
      "appliedScopes": [
        "00000000-0000-0000-0000-00000000"
      ],
      "onDemandRate": 0.519,
      "product": "Standard_DS13_v2",
      "region": "westus",
      "reservationRate": 0.302549467275493,
      "resourceType": "virtualmachines"
    },
    "resourceGroup": null,
    "savings": {
      "calculatedSavings": [
        {
          "onDemandCost": 368.4813602070006,
          "overageCost": 0,
          "quantity": 2,
          "reservationCost": 429.01514459665,
          "totalReservationCost": 429.01514459665,
          "savings": -60.5337843896494
        },
        {
          "onDemandCost": 368.481360207,
          "overageCost": 1.557,
          "quantity": 1,
          "reservationCost": 214.507572298325,
          "totalReservationCost": 216.064572298325,
          "savings": 152.416787908675
        }
      ],
      "lookBackPeriod": 30,
      "recommendedQuantity": 1,
      "reservationOrderTerm": "P3Y",
      "savingsType": "instance",
      "unitOfMeasure": "hour"
    },
    "scope": "Single",
    "usage": {
      "firstConsumptionDate": "2020-02-03T00:00:00",
      "lastConsumptionDate": "2020-03-03T13:00:00",
      "lookBackUnitType": "virtualMachine quantity",
      "usageData": [
        1,
        1,
        1,
        1,
        1,
        1
      ],
      "usageGrain": "hourly"
    }
  }
}

定义

名称 说明
HighCasedErrorDetails

错误的详细信息。

HighCasedErrorResponse

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

某些错误响应:

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

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

lookBackPeriod

筛选预留建议结果所基于的时间段。

ReservationRecommendationDetailsCalculatedSavingsProperties

估计节省的详细信息。 估算了该术语的成本和节省。

ReservationRecommendationDetailsModel

预留建议详细信息。

ReservationRecommendationDetailsResourceProperties

资源的详细信息。

ReservationRecommendationDetailsSavingsProperties

估计节省的详细信息。

ReservationRecommendationDetailsUsageProperties

有关用于计算建议的历史使用情况数据的详细信息。

scope

预留的范围。

term

指定预留建议期限的长度。

HighCasedErrorDetails

错误的详细信息。

名称 类型 说明
code

string

错误代码。

message

string

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

HighCasedErrorResponse

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

某些错误响应:

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

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

名称 类型 说明
error

HighCasedErrorDetails

错误的详细信息。

lookBackPeriod

筛选预留建议结果所基于的时间段。

名称 类型 说明
Last30Days

string

使用 30 天的数据获取建议

Last60Days

string

使用 60 天的数据获取建议

Last7Days

string

使用 7 天的数据进行建议

ReservationRecommendationDetailsCalculatedSavingsProperties

估计节省的详细信息。 估算了该术语的成本和节省。

名称 类型 说明
onDemandCost

number

无预留的成本。 包括硬件和软件成本。

overageCost

number

预留未涵盖的资源的硬件和软件成本。

quantity

number

计算节省的数量。

reservationCost

number

预留涵盖的资源的硬件成本。

reservedUnitCount

number

用于计算节省的预留单位数。 对于虚拟机,始终为 1。

savings

number

通过购买建议的预留数量节省的金额。 这等于 onDemandCost - totalReservationCost。

totalReservationCost

number

预留成本 + 预留涵盖的资源的软件成本 + 超额成本。

ReservationRecommendationDetailsModel

预留建议详细信息。

名称 类型 说明
etag

string

资源的 etag。

id

string

事件的完全限定 ARM ID。

location

string

资源位置。

name

string

唯一标识事件的 ID。

properties.currency

string

成本和节省的 ISO 4217 货币代码标识符

properties.resource

ReservationRecommendationDetailsResourceProperties

特定于资源的属性。

properties.resourceGroup

string

资源组。

properties.savings

ReservationRecommendationDetailsSavingsProperties

建议的节省信息。

properties.scope

string

预留范围,例如:单个或共享。

properties.usage

ReservationRecommendationDetailsUsageProperties

用于计算估计节省额的历史使用情况详细信息。

sku

string

资源 SKU

tags

object

资源标记。

type

string

资源类型。

ReservationRecommendationDetailsResourceProperties

资源的详细信息。

名称 类型 说明
appliedScopes

string[]

应用预留的订阅列表。

onDemandRate

number

资源的每小时按需速率。 仅包括硬件费率,即不包括软件费率。

product

string

Azure 产品例如:Standard_E8s_v3等。

region

string

Azure 资源区域,例如:EastUS、WestUS 等。

reservationRate

number

资源的每小时预留费率。 因术语而异。

resourceType

string

Azure 资源类型。

ReservationRecommendationDetailsSavingsProperties

估计节省的详细信息。

名称 类型 说明
calculatedSavings

ReservationRecommendationDetailsCalculatedSavingsProperties[]

计算节省的列表。

lookBackPeriod

integer

用于计算建议的使用情况的天数。

recommendedQuantity

number

资源的建议单位数。

reservationOrderTerm

string

预留期限,例如:P1Y 或 P3Y。

savingsType

string

节省的类型,例如: 实例。

unitOfMeasure

string

度量单位,例如:小时等。

ReservationRecommendationDetailsUsageProperties

有关用于计算建议的历史使用情况数据的详细信息。

名称 类型 说明
firstConsumptionDate

string

用于查找计算建议的第一个使用日期。

lastConsumptionDate

string

用于查找计算建议的上次使用日期。

lookBackUnitType

string

使用情况数据值表示的内容,例如:虚拟机实例。

usageData

number[]

历史资源使用情况的细目。 值按 firstConsumptionDate 和 lastConsumptionDate 之间的使用顺序排列。

usageGrain

string

使用情况数据中表示的值的粒度,例如:每小时。

scope

预留的范围。

名称 类型 说明
Shared

string

Single

string

term

指定预留建议期限的长度。

名称 类型 说明
P1Y

string

1 年预留期限

P3Y

string

3 年预留期限