Is there any way we can get the cost of individual resources using Azure Python SDK[https://learn.microsoft.com/en-us/python/api/overview/azure/?view=azure-python]?
I have used RateCard[https://learn.microsoft.com/en-us/python/api/azure-mgmt-commerce/azure.mgmt.commerce.operations.ratecardoperations?view=azure-python] and Usage[https://learn.microsoft.com/en-us/python/api/azure-mgmt-commerce/azure.mgmt.commerce.operations.usageaggregatesoperations?view=azure-python] API's to calculate the cost. But looking for a better solution.
query = "OfferDurableId eq '" + offer_id + \
"' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'"
ratecard = usage_client.rate_card.get(filter=query)
usage = usage_client.usage_aggregates.list(reported_start_time=start,
reported_end_time=end,
show_details=True,
aggregation_granularity="Daily"):
Get cost of individual resource for last 30 days using Azure SDK.