[英]Retrieving last month cost of an Azure subscription using Python SDK
I am trying to retrieve the total cost of a subscription for a given month (let's say last month). 我正在尝试检索给定月份(比如上个月)的订阅总费用。
I tried using ComputeManagementClient
but I always end up with a whole list of usage details, even when I use a filter in the following way : 我尝试使用
ComputeManagementClient
但即使使用以下方式使用过滤器,我也总是最终得到用法详细信息的完整列表:
c_client = ConsumptionManagementClient(creds, sub_id)
startDate = '2019-03-01T00:00:00Z'
endDate = '2019-03-31T23:59:59Z'
filt = "usageStart eq {} and usageEnd eq {}".format(startDate, endDate)
result = c_client.usage_details.list(filter=filt)
...
What am I doing wrong ? 我究竟做错了什么 ? Do I have to iterate through pages and calculate the total cost by myself ?
我是否需要遍历页面并自己计算总费用?
EDIT : Thanks to @Joy Wang answer, I get further. 编辑:感谢@Joy Wang的答复,我走得更远。 But now I end up with daily usage details from the current month instead of last month - whereas I am sure that this subscription was running last month.
但是,现在我得到的是当月而不是上个月的每日使用情况详细信息,而我确定此订阅已在上个月运行。 Any idea ?
任何想法 ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.