I'm trying to look up the previous date through API but it's failing.

Sunyoup Park (박선엽) 105 Reputation points
2023-09-21T11:28:48.8966667+00:00

https://learn.microsoft.com/en-us/rest/api/consumption/usage-details/list?tabs=HTTP#billingprofileusagedetailslist-modern

I'm trying to look up the data from the previous period, not the current month, through this API.

It is written in the document that billing periods can be set in the 'SCOPE' parameter, and in this way, the API is called as follows, but only the current month's data is searched.

https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{myBillingAccountName}/billingProfiles/{myBillingProfileName}/providers/Microsoft.Billing/billingPeriods/202307/providers/Microsoft.Consumption/usageDetails?api-version=2023-05-01

Please ask what kind of problem it is and answer it.

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,674 questions
Microsoft Partner Center API
Microsoft Partner Center API
Microsoft Partner Center: A Microsoft website for partners that provides access to product support, a partner community, and other partner services.API: A software intermediary that allows two applications to interact with each other.
344 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ryan Hill 28,546 Reputation points Microsoft Employee
    2023-09-25T16:51:23.5466667+00:00

    Hi @Sunyoup Park (박선엽)

    This API is being deprecated. Instead of using it, have you attempted using the Generate Cost Details Report API instead? So instead of the above request, you would do

    POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2023-08-01
    
    {
      "metric": "ActualCost",
      "billingPeriod": "202307"
    }
    

    Where billingAccountId is the billing id from Cost+Management properties page.


0 additional answers

Sort by: Most helpful

Your answer

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