I'm trying to access Azure resources through rest api i'm getting error ?

Vikas Singh 1 Reputation point
2021-06-04T13:45:59.523+00:00

This is my post man response body
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "The received access token is not valid: at least one of the claims 'puid' or 'altsecid' or 'oid' should be present. If you are accessing as application please make sure service principal is properly created in the tenant."
}
}

https://learn.microsoft.com/en-us/rest/api/resources/resources/list-by-resource-group

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,000 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 55,301 Reputation points
    2021-06-04T15:02:58.43+00:00

    You are either using an invalid auth token or you didn't associate it with your request properly. Refer to the documentation in Azure on how to properly create an auth token to use with Azure. There is a full discussion on how to do this with Postman here.

    1 person found this answer helpful.
    0 comments No comments

  2. ajkuma 27,256 Reputation points Microsoft Employee
    2021-06-11T15:17:01.407+00:00

    @VikasSingh-0102, Just checking if the suggestions posted by cooldadtx was helpful.

    Typically, missing OID usually means the servicePrincipal for your app does not exist in the tenant in which your trying to access.
    Each tenant in which you want to access must consent to your application. This will ensure the servicePrincipal exists in their tenant and that servicePrincipal has access to the Azure API.

    Kindly let us know if you need further assistance with some more (resource/webapps) details.

    Note: Please do not share any PII data on the public forum.


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.