How to get 'credit available' and 'days remain' using Azure Billing API?

早过忘川 提交于 2019-12-12 01:37:56

问题


Is it possible to get the two indicators of the old management portal using the Azure Billing or RateCard API like shown below?

thank you!


回答1:


So there're two things you're looking for:

  • Subscription Billing Period: As of today, it is not possible to fetch the billing period of a Subscription programmatically.
  • Remaining Credits: Remaining credits is not directly available via the API however it is possible to calculate this. For this first, you would need to find the total credits available. This information can be fetched via Rate Cart API. This will be available under OfferTerms element in the response.

"OfferTerms": [ { "Name": "Monetary Credit", "Credit": 500.0, "ExcludedMeterIds": [ "c7c86eef-7094-47d5-83e7-c3c9be5af0bf", "4b8b8092-a2d7-4785-9b9f-76104f4c7269", "7e266189-fb95-4615-af5b-126a00e78714", "20f1b323-0950-4527-b4f3-d77e2b7aca16" ], "EffectiveDate": "2014-04-01T00:00:00Z" } ]

Next you would need to calculate the actual usage using the Usage API. Based on the usage and the rate card, you will need to calculate the usage amount. Difference between the credit and this amount will give you remaining amount.



来源:https://stackoverflow.com/questions/43025272/how-to-get-credit-available-and-days-remain-using-azure-billing-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!