What is the reassures id for giving admin access to the app

Rajendran Kalichath 0 Reputation points
2024-11-13T08:07:53.2266667+00:00

Currently am trying to give access to my app using this endpoint

https://graph.microsoft.com/v1.0/oauth2PermissionGrants

My request body is like this

{

"clientId": "",

"consentType": "AllPrincipals",

"scope": "Application.ReadWrite.All",

"resourceId": "c2ae4244-2cbe-47f0-b458-26cc9f39871b"

}

here client ID is the service principal id, but I need to know the value which I need to pass for resourceId. Am specifically looking for Microsoft Graph.

am always getting this error from endpoint

{

"error": {

    "code": "Request_BadRequest",

    "innerError": {

        "client-request-id": "",

        "date": "2024-11-12T14:18:16",

        "request-id": "7c92f240-763f-493b-932d-eb149fa7d65e"

    },

    "message": "Specified resourceId was not found."

}

}

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,184 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 108.3K Reputation points MVP
    2024-11-13T08:31:15.6033333+00:00

    You need to pass the Id of the service principal corresponding to the resource in question. For the case of the Graph, this would be:

    Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'" 
    

  2. Rajendran Kalichath 0 Reputation points
    2024-11-14T04:31:12.69+00:00

    we can hit this GET endpoint https://graph.microsoft.com/v1.0/servicePrincipals?$filter=appId eq '00000003-0000-0000-c000-000000000000'

    here I used ms graph appid.

    This will give list values where we just need to pick the id value and that can be use as resourceid in oauth2PermissionGrants payload request body.

    0 comments No comments

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.