共用方式為


從取用使用量詳細資料 API 移轉

本文討論從取用使用量詳細資料 API 移轉。 取用使用量詳細資料 API 已被取代。 仍在決定將關閉 API 的日期。 我們建議您盡快從 API 移轉。

移轉目的地

請先閱讀選擇成本詳細資料解決方案一文,再選擇您的工作負載適用的解決方案。 一般而言,如果您有進行中的資料擷取需求和或大型每月使用量詳細資料資料集,建議您匯出。 如需詳細資訊,請參閱內嵌使用量詳細資料

如果您有較小的使用量詳細資料資料集或匯出不符合的案例,請考慮改用成本詳細資料報表。 如需詳細資訊,請參閱視需要取得小型成本資料集

注意

[成本詳細資料] 報表僅適用於有 Enterprise 合約或 Microsoft 客戶合約的客戶。 如果您有 MSDN、隨用隨付或 Visual Studio 訂閱,您可以移轉至匯出或使用使用量詳細資料 API 繼續。

移轉優點

新的解決方案可透過使用量詳細資料 API 提供許多優點。 摘要如下:

  • 所有使用量詳細資料的單一資料集 - Azure 和 Azure Marketplace 使用量詳細資料已合併成一個資料集。 這可減少您需要呼叫的 API 數目,以查看所有費用。
  • 可擴縮性 - MarketplaceS API 已被取代,因為它會升級無法隨著 Azure 使用量增加而調整的呼叫模式。 您將更多資源部署到雲端時,使用量詳細資料資料集可能會變得非常大。 Marketplaces API 是編頁同步 API,因此未最佳化,以高效率和可靠性有效地透過網路傳輸大量資料。 匯出和成本詳細資料 API 為非同步。 它們會提供 CSV 檔案,可透過網路直接下載。
  • API 改善 - 匯出和成本詳細資料 API 是 Azure 支援持續進行的解決方案。 所有新功能都會整合到其中。
  • 結構描述一致性 - [成本詳細資料] 報表和 [匯出] 會根據您的案例提供有相符欄位的檔案,因此您可以從一個解決方案移至另一個解決方案。
  • 成本配置整合 - 使用匯出或成本詳細資料 API 的 Enterprise 合約和 Microsoft 客戶合約客戶可以檢視本身設定的成本配置規則有關的費用。 如需成本配置的詳細資訊,請參閱配置成本

欄位差異

下表摘要說明使用量詳細資料 API 和匯出/成本詳細資料 API 之間的欄位差異。 匯出和成本詳細資料 API 會提供 CSV 檔案下載,而不會提供由取用 API 提供的編頁 JSON 回應。

Enterprise 合約欄位對應

使用使用量詳細資料 API 的 Enterprise 合約客戶擁有類型 legacy 的使用量詳細資料記錄。 舊版使用量詳細資料記錄如下所示。 因為用於這些記錄的基礎帳單系統,所有 Enterprise 合約客戶都有這種記錄。

{  

  "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
成本 CostInBillingCurrency
costCenter CostCenter
date Date
effectivePrice EffectivePrice
頻率 頻率
invoiceSection InvoiceSectionName
InvoiceSectionId InvoiceSectionId
isAzureCreditEligible IsAzureCreditEligible
meterCategory 計量類別目錄
meterId MeterId
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
數量 數量
ReservationId ReservationId
ReservationName ReservationName
resourceGroup ResourceGroup
resourceId ResourceId
resourceLocation 資源位置
resourceName ResourceName
serviceFamily ServiceFamily
ServiceInfo1 ServiceInfo1
ServiceInfo2 ServiceInfo2
subscriptionId SubscriptionId
subscriptionName SubscriptionName
Tags (標籤) 標籤
字詞 詞彙
unitOfMeasure UnitOfMeasure
unitPrice UnitPrice
CostAllocationRuleName CostAllocationRuleName

Microsoft 客戶合約欄位對應

使用使用量詳細資料 API 的 Microsoft 客戶合約客戶擁有類型 modern 的使用量詳細資料記錄。 新式使用量詳細資料記錄如下所示。 因為用於這些記錄的基礎帳單系統,所有 Microsoft 客戶合約客戶都有這種記錄。

{  

  "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 位置
resourceLocation 位置
effectivePrice effectivePrice
數量 數量
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