Automating Role Assignments for Multi-Tenant Applications Using Graph API

MP732 40 Reputation points
2024-10-17T17:10:04.08+00:00

Is there a way to automate assigning the User Administrator role to our multi-tenant application across tenant accounts using Graph API? Currently, this process is done manually, but I'm looking for an API call that could possibly take the tenant ID for the desired tenant, application ID for the application and the role template ID for the desired role. I've searched for information but haven't found much on this.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 123.8K Reputation points MVP Volunteer Moderator
    2024-10-18T06:52:55.5733333+00:00

    Assigning directory roles via the Graph API is possible, including to service principals. However the permissions required for that effectively give your app "the keys to the kingdom", so I doubt many organizations will be fine with granting them.

    Here's the corresponding endpoint: https://learn.microsoft.com/en-us/graph/api/directoryrole-post-members?view=graph-rest-1.0&tabs=http

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.