Search code examples
azureazure-active-directorymicrosoft-graph-apiazure-ad-graph-api

Query for specific Azure AD permission


Is there a way in Microsoft Graph how to check whether signed-in user (device code auth is used) has a specific AAD permission? In my case that would be Microsoft.Directory/groups/members/update - I'd like to notify a user that he/she is not permitted to add service principal to an AD group.

My initial idea was to find DirectoryRoles a user is member of. Then view related DirectoryRoleTemplates and somehow check permissions attached to the template. It looks like this is not possible.


Solution

  • Currently Microsoft has not exposed an API for obtaining Role permissions corresponding to DirectoryRole.

    Based on the official document, microsoft.directory/groups/members/update permission only exists in the following roles:

    • Directory Writers

    • Groups Administrator

    • User Account Administrator

    • Intune Service Administrator

    • Partner Tier1 Support

    • Partner Tier2 Support

    A workaround is to customize a config file in your project to set the fixed values. Read them to see if the user's directory role matches one of them.