Azure EA (3) 使用Postman訪問海外Azure Billing API

  《Windows Azure Platform 系列文章目錄html

 

  本文介紹的是海外版的Azure Global服務,由於跨境內境外網絡,訪問速度會比較慢api

 

  在開始使用Azure Billing API以前,咱們須要準備:網絡

  1.登陸https://portal.azure.com,拿到Enrollment Numberide

  

  2.獲取Azure  Billing API Key。以下圖:post

  

 

  3.有關Azure海外的Billing API,請參考:https://docs.microsoft.com/en-us/azure/billing/billing-enterprise-apiui

  這裏簡單介紹2個API:url

  (1)查看帳單使用量摘要spa

  (2)查看帳單高級報告下載orm

  

 

  一.查看帳單使用量摘要:htm

  1.REST API

Method Request URL
Get https://consumption.azure.com/v3/enrollments/{enrollmentNumber}/balancesummary
舉例說明 https://consumption.azure.com/v3/enrollments/8608480/balancesummary

  2.Request Header

Request Header Key Value
Authorization bearer {API Key}

  3.返回結果

  

 

  返回結果的字段說明:

字段名 字段說明
id  
billingPeriodId 計費週期
currencyCode 貨幣單位
beginningBalance 初期餘額
endingBalance 期末餘額
newPurchases 新購買
adjustments 調整
utilized 使用量 (從餘額中扣除)
serviceOverage 服務超額
chargesBilledSeparately 單獨計費的費用
totalOverage 總超額
totalUsage 總使用量 (承諾使用量+超額)
azureMarketplaceServiceCharges Azure應用市場服務使用量
newPurchasesDetails 新購買
adjustmentDetails 調整詳細信詳細信息
billingPeriodStart 計費週期開始時間
billingPeriodEnd 計費週期結束時間
balanceDeduct 餘額扣除

 

 

  二.查看帳單高級報告下載

  1.REST API

  

Method Request URL
Get https://consumption.azure.com/v3/enrollments/{enrollmentNumber}/usagedetails/download?billingPeriod={billingPeriod}
舉例說明 https://consumption.azure.com/v3/enrollments/8608480/usagedetails/download?startTime=2019-07-20&endTime=2019-08-10

  2.Request Header

  

Request Header Key Value
Authorization bearer {API Key}

  3.返回結果

  

 

  返回結果的字段說明:

字段名 說明
AccountId 建立該訂閱的ID
AccountName 帳戶名稱
AccountOwnerEmail 帳戶全部者郵箱
AdditionalInfo 附加信息 
ConsumedQuantity 已消耗的數量 
ConsumedService 消耗的服務類型 
ConsumedServiceId 消耗的服務ID
Cost 費用 
CostCenter 資源所屬的Cost Center成本中心 ,成本中心只在EA Portal裏面定義
Date 表示該計費資源的計費時間,好比2019-06-01
DepartmentId 部門ID 
DepartmentName 資源所屬的部門,部門只在EA Portal裏面定義
InstanceId  

資源的惟一ID

對於ARM資源來講,組件展示的形式以下:

/subscriptions/{訂閱ID}/resourceGroups/{資源組名稱}/providers/Microsoft.Compute/virtualMachines/{虛擬機名稱}

MeterCategory 服務的一級類別
MeterId 類別Id 
MeterName 類別名稱 
MeterRegion 類別區域 
MeterSubCategory 服務的二級類別 
Product 產品 
ProductId 產品Id 
ResourceGroup 資源組 
ResourceLocation 資源組所屬區域 
ResourceLocationId 資源組所屬區域Id 
ResourceRate 每計費單位適用的費率 
ServiceAdministratorId 服務管理員Id
ServiceInfo1 服務信息1
ServiceInfo2 服務信息2 
StoreServiceIdentifier 該字段不常用 
SubscriptionGuid  訂閱Guid
SubscriptionId 訂閱ID 
SubscriptionName 訂閱的顯示名稱 
Tags 標籤 
UnitOfMeasure

列:已消耗的資源數量的單位

好比虛擬機計算資源,是按照小時來收費的,則該列顯示爲Hour

對於存儲來講,是按照GB來收費的。則該列會顯示GB

 
PartNumber 服務的SKU Number
ResourceGuid 不常用 
OfferId 不常用
ChargesBilledSeparately 超出貨幣承諾的收費
Location 服務所在數據中心區域
ServiceName 服務名稱 
ServiceTier 服務等級
相關文章
相關標籤/搜索