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'"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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."
}
}
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'"
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.