How to run a Generate Cost Details Report API call with a Billing account and Customer scope?

Rik Groenewoud (privé) 0 Reputation points
2024-05-30T07:02:17.98+00:00

When I read the documentation there is an example like this:

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2023-11-01

{ "metric": "ActualCost", "invoiceId": "M1234567" }

https://learn.microsoft.com/en-us/rest/api/cost-management/generate-cost-details-report/create-operation?view=rest-cost-management-2023-11-01&tabs=HTTP#generatecostdetailsreportbybillingprofileandinvoiceid

However when I try this call I get:
Invoke-RestMethod:

{

"error": {

"code": "MissingSubscription",

"message": "The request did not have a subscription or a valid tenant level resource provider."

}

}

But I don't want to use a subscription scope. I want to use the scope as the example above.
Is this possible?

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
3,578 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rik Groenewoud (privé) 0 Reputation points
    2024-06-05T15:21:07.27+00:00

    We found the solution. The correct URI is for Billing Account scope is:

    https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/$billingAccountId/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2023-11-01"
    
    
    

    I made a mistake in the URI.

    Thanks for your help.


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.