Azure COST API call via O365 login

Dondapati, Navin 281 Reputation points
2021-07-29T14:01:49.217+00:00

Hi Guys,

We are using below cost api url to fetch data
https://management.azure.com/subscriptions/1313131`131313/resourceGroups/rg1/providers/Microsoft.CostManagement/query?api-version=2019-11-01

it works fine when use it below url
https://learn.microsoft.com/en-us/rest/api/cost-management/dimensions/list

But when we test in post man or other tools we receive below error
{
"error": {
"code": "AuthenticationFailed",
"message": "Authentication failed. The 'Authorization' header is missing."
}
}

We tried to pass user=xyz@zyz.com (company O365 id which has access to that resource group) and pwd=xyz in the body.

Regards,
Navin

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

2 answers

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 41,716 Reputation points Microsoft Employee
    2021-07-30T19:36:40.28+00:00

    @Anonymous - As mentioned, you need to pass the auth header in the request. The article below calls out options (using Postman)to authenticate to Azure Resource Manager.

    Authenticate Postman against Azure Service Management API | Codit

    ---------------------------------------------------------------------------------------------------------------

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

    0 comments No comments

  2. Dondapati, Navin 281 Reputation points
    2021-07-30T19:39:28.16+00:00
    0 comments No comments