Revoke app role assignment from service principal not working

Helen Yang 0 Reputation points Microsoft Employee
2025-02-19T18:15:44.6033333+00:00

Hi there,

I'm reporting this issue here because I first reported it here: https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/3142 and was routed to Microsoft Graph support page, where I couldn't find a bug reporting page and the known issues page is rendering an error.

When I invoke the endpoint to revoke a service principal app role assignment it fails with Status 400 and the message: Invalid resource identifier for EntitlementGrant. I have tried this both on powershell and C# SDK and am using a valid SP id and app role assignment id (I used to same one to create the app role). I also tried with several different valid app role ids and each fails with this error. Is this a known bug? When will it get fixed or is there working call for revoking app role assignments for service principals? I've attached a screenshot executing from powershell

Image

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,310 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 115.7K Reputation points MVP
    2025-02-20T08:27:09.2533333+00:00

    That's not how you use the endpoint, the identifier of an AppRoleAssignment is not a GUID. You seem to be passing the identifier for a AppRoleId instead, which will not work. Do a GET query against /servicePrincipals/{servicePrincipalid}/appRoleAssignments first to get the id of the corresponding AppRoleAssignment, then use said id in the Delete operation.

    User's image


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.