Share via

When are costs available through the cost API?

Eben Roux 20 Reputation points
2024-04-17T05:48:56.47+00:00

I'm retrieving costs on a daily basis. Since we are GMT+2 I am only retrieving costs for two days ago. I would take today's date and subtract 2 days, so for 17 April 2024 I would get the costs for 15 April 2024. I have a scheduled job that performs this processing at 2h00 each morning.

However, I have found that at times the costs returned are not correct. They mostly are, though. I have even had days where absolutely no costs are returned for ZAR costs, but a couple of the USD costs are returned.

My question is therefore: when are costs guaranteed to be available through the cost API? Should I increase to 3 days, or perhaps a week? Or is there perhaps a way that I can check cost availability through the API?

Cost Management
Cost Management

A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.

0 comments No comments

Answer accepted by question author

  1. Sadiqh Ahmed 49,571 Reputation points Microsoft External Staff Moderator
    2024-04-17T10:42:06.69+00:00

    Hello @Eben Roux Thank you for posting your question on the Microsoft Q&A platform. Happy to help!

    From the information you provided, I understand that you have a requirement to retrieve cost data on daily basis and when tried with "today's date and subtract 2 days" the cost data is incorrect.

    You should use Today's date and 3 days to get the accurate cost. It will still be an approximate. However, you will see the cost via the API which would mostly match with the Cost Management in the Portal UX. Doc reference: https://learn.microsoft.com/en-us/rest/api/cost-management/

    Hope this helps. If you have any questions, please reply to this post and we will take it further.


    If the response helped, do "Accept Answer" and up-vote it

    Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.