As per the MS Graph document, you can address the service principal using either its id or appId.
Id and AppId are referred to as the Object ID and Application (Client) ID, respectively, in the Azure portal
There are two ways to list appRoleAssignments.
- [GET /servicePrincipals(appId='{appId}')/appRoleAssignments] .
- https://graph.microsoft.com/v1.0/servicePrincipals/{Id}/appRoleAssignedTo (the ID should be the servicePrincipal ID).
I was able to replicate the issue if I am using appid in the request url:
Using service principal ID in the below request, I was able to get desired response.
Using [GET /servicePrincipals(appId='{appId}')/appRoleAssignments]
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.