从消耗使用情况详细信息 API 迁移
本文介绍如何从消耗用量详细信息 API 迁移,我们已计划弃用该 API。 具体的弃用日期仍有待确定。 建议不要使用此 API 生成报告管道,而应该尽快迁移。
企业协议 (EA) 报告 API(使用 API 密钥进行身份验证并通过 consumption.azure.com URI 终结点访问)将停用。 使用这些 API 的 EA 客户应迁移到成本管理成本详细信息 API。 这些旧版 EA 报告 API 仅适用于签订了企业协议的客户。
如果你使用的是消耗用量详细信息 API,我们建议(但不要求)迁移到成本管理成本详细信息 API。
消耗量和成本管理 API 可供 EA 和 Microsoft 客户协议 (MCA) 客户使用。 因此,仍然签订了 EA 的 Azure 政府客户不会受到负面影响。
从 EA 迁移到 MCA 时,我们建议从 EA 用量详细信息报告 API 迁移到成本管理成本详细信息 API 并使用导出。
在选择适合你工作负载的解决方案之前,请阅读选择成本详细信息解决方案一文。 一般情况下,如果要持续引入数据或每月使用情况详细信息数据集较大,则建议使用导出。 有关详细信息,请参阅引入使用情况详细信息数据。
如果用量详细信息数据集较小或场景不满足“导出”的条件,请考虑改用成本详细信息报告。 有关详细信息,请参阅按需获取小型成本数据集。
备注
成本详细信息报告仅适用于具有企业协议或 Microsoft 客户协议的客户。 如果你有 MSDN、即用即付或 Visual Studio 订阅,则可以迁移到导出或使用消耗使用情况详细信息 API 继续。
与耗使用情况详细信息 API 相比,新解决方案提供了许多优势。 摘要如下:
- 单个数据集用于所有使用情况详细信息 - Azure 和 Azure 市场使用情况详细信息已合并为一个数据集。 该数据集减少了查看所有费用需要调用的 API 数。
- 可伸缩性 - 市场 API 已弃用,因为它提升的调用模式无法随着 Azure 使用量的增加而缩放。 随着将更多资源部署到云中,使用情况详细信息数据集可能会变得非常大。 市场 API 是一个分页同步 API,因此它没有经过优化,无法通过网络高效可靠地有效传输大量数据。 “导出”和成本详细信息 API 是异步的。 它们提供可通过网络直接下载的 CSV 文件。
- API 改进 - 导出和成本详细信息 API 是 Azure 支持发展的解决方案。 所有新功能都将集成到这些解决方案中。
- 架构一致性 - 成本详细信息 API 和导出可为文件提供匹配字段 os,你可以根据方案将其从一个解决方案迁移到另一个解决方案。
- 成本分配集成 - 使用导出或成本详细信息 API 的企业协议和 Microsoft 客户协议客户可以查看与已配置的成本分配规则相关的费用。 有关成本分配的详细信息,请参阅分配成本。
下表汇总了“消耗使用情况详细信息”API 和“导出”/“成本详细信息”API 之间的字段差异。 “导出”和“成本详细信息”API 提供 CSV 文件下载,而不是消耗 API 提供的分页 JSON 响应。
使用“消耗使用情况详细信息”API 的企业协议客户具有类型 legacy
的使用情况详细信息记录。 由于所有企业协议客户都会使用基础计费系统,因此他们都有此类型的记录。 下面是旧版用量详细信息记录示例:
{
"value": [
{
"id": "{id}",
"name": "{name}",
"type": "Microsoft.Consumption/usageDetails",
"kind": "legacy",
"tags": {
"env": "newcrp",
"dev": "tools"
},
"properties": {
…...
}
}
使用情况详细信息 - 列表 - REST API(Azure 消耗)中显示了完整的旧式使用情况详细信息记录示例
下表提供了旧字段和新字段之间的映射。 “导出”和“成本详细信息”API 生成的 CSV 文件中提供了新属性。 若要了解有关字段的详细信息,请参阅了解使用情况详细信息字段。
粗体属性名称保持不变。
旧属性 | 新属性 |
---|---|
accountName | AccountName |
AccountOwnerId | AccountOwnerId |
additionalInfo | AdditionalInfo |
AvailabilityZone | AvailabilityZone |
billingAccountId | BillingAccountId |
billingAccountName | BillingAccountName |
billingCurrency | BillingCurrencyCode |
billingPeriodEndDate | BillingPeriodEndDate |
billingPeriodStartDate | BillingPeriodStartDate |
billingProfileId | BillingProfileId |
billingProfileName | BillingProfileName |
chargeType | ChargeType |
consumedService | ConsumedService |
cost | CostInBillingCurrency |
costCenter | CostCenter |
date | 日期 |
effectivePrice | EffectivePrice |
频率 | 频率 |
invoiceSection | InvoiceSectionName |
InvoiceSectionId | InvoiceSectionId |
isAzureCreditEligible | IsAzureCreditEligible |
meterCategory | MeterCategory |
meterId | 计量 ID |
meterName | MeterName |
MeterRegion | MeterRegion |
meterSubCategory | MeterSubCategory |
offerId | OfferId |
partNumber | PartNumber |
PayGPrice | PayGPrice |
PlanName | PlanName |
PricingModel | PricingModel |
product | ProductName |
ProductOrderId | ProductOrderId |
ProductOrderName | ProductOrderName |
PublisherName | PublisherName |
PublisherType | PublisherType |
quantity | 数量 |
ReservationId | 预订 ID |
ReservationName | ReservationName |
resourceGroup | ResourceGroup |
ResourceId | ResourceId |
resourceLocation | ResourceLocation |
resourceName | ResourceName |
serviceFamily | ServiceFamily |
ServiceInfo1 | ServiceInfo1 |
ServiceInfo2 | ServiceInfo2 |
subscriptionId | SubscriptionId |
subscriptionName | SubscriptionName |
标记 | 标记 |
条款 | 术语 |
unitOfMeasure | UnitOfMeasure |
unitPrice | UnitPrice |
CostAllocationRuleName | CostAllocationRuleName |
使用“消耗使用情况详细信息”API 的 Microsoft 客户协议客户具有类型 modern
的使用情况详细信息记录。 由于所有 Microsoft 客户协议客户都会使用基础计费系统,因此他们都有此类型的记录。 下面是 MCA 用量详细信息记录示例:
{
"value": [
{
"id": "{id}",
"name": "{name}",
"type": "Microsoft.Consumption/usageDetails",
"kind": "modern",
"tags": {
"env": "newcrp",
"dev": "tools"
},
"properties": {
…...
}
}
使用情况详细信息 - 列表 - REST API(Azure 消耗)中显示了完整的旧式使用情况详细信息记录示例
下表显示了旧字段和新字段之间的映射。 “导出”和“成本详细信息”API 生成的 CSV 文件中提供了新属性。 由于解决方案之间的差异而需要映射的字段以粗体文本显示。
有关详细信息,请参阅了解使用情况详细信息字段。
旧属性 | 新属性 |
---|---|
invoiceId | invoiceId |
previousInvoiceId | previousInvoiceId |
billingAccountId | billingAccountId |
billingAccountName | billingAccountName |
billingProfileId | billingProfileId |
billingProfileName | billingProfileName |
invoiceSectionId | invoiceSectionId |
invoiceSectionName | invoiceSectionName |
partnerTenantId | partnerTenantId |
partnerName | partnerName |
resellerName | resellerName |
resellerMpnId | resellerMpnId |
customerTenantId | customerTenantId |
customerName | customerName |
costCenter | costCenter |
billingPeriodEndDate | billingPeriodEndDate |
billingPeriodStartDate | billingPeriodStartDate |
servicePeriodEndDate | servicePeriodEndDate |
servicePeriodStartDate | servicePeriodStartDate |
date | date |
serviceFamily | serviceFamily |
productOrderId | productOrderId |
productOrderName | productOrderName |
consumedService | consumedService |
meterId | meterId |
meterName | meterName |
meterCategory | meterCategory |
meterSubCategory | meterSubCategory |
meterRegion | meterRegion |
productIdentifier | ProductId |
product | ProductName |
subscriptionGuid | SubscriptionId |
subscriptionName | subscriptionName |
publisherType | publisherType |
publisherId | publisherId |
publisherName | publisherName |
resourceGroup | resourceGroupName |
INSTANCENAME | ResourceId |
resourceLocationNormalized | location |
resourceLocation | location |
effectivePrice | effectivePrice |
quantity | quantity |
unitOfMeasure | unitOfMeasure |
chargeType | chargeType |
billingCurrencyCode | billingCurrency |
pricingCurrencyCode | pricingCurrency |
costInBillingCurrency | costInBillingCurrency |
costInPricingCurrency | costInPricingCurrency |
costInUsd | costInUsd |
paygCostInBillingCurrency | paygCostInBillingCurrency |
paygCostInUSD | paygCostInUsd |
exchangeRatePricingToBilling | exchangeRatePricingToBilling |
exchangeRateDate | exchangeRateDate |
isAzureCreditEligible | isAzureCreditEligible |
serviceInfo1 | serviceInfo1 |
serviceInfo2 | serviceInfo2 |
additionalInfo | additionalInfo |
标记 | 标记 |
partnerEarnedCreditRate | partnerEarnedCreditRate |
partnerEarnedCreditApplied | partnerEarnedCreditApplied |
marketPrice | PayGPrice |
频率 | 频率 |
关键词 | 关键词 |
reservationId | reservationId |
reservationName | reservationName |
pricingModel | pricingModel |
unitPrice | unitPrice |
exchangeRatePricingToBilling | exchangeRatePricingToBilling |
- 有关成本管理 + 计费自动化的详细信息,请参阅成本管理自动化概述。