I’d like to give some Graph API permission to a non-admin user Bob, so that it is able to read some data without requiring the admin consent.
If I give the admin consent here every permission is given to each user, but I want to give only a subset of permissions to Bob.
So I:
- Registred a new application
- Set the Graph Explorer permissions I am interested in to the App (both as delegated and as application)
- Granted administrator consent to such permissions
- Assigned the application to Bob
But still, after logging in as Bob, the graph explorer tells me that I don’t have the required permissions to (for example) list all the users in the organization.
Any help is highly appreciated!
2
Answers
The Graph Explorer uses what Microsoft calls, step-up consent. Meaning the token it requests (and the user consents to) are configured at runtime.
So if you approved some permissions, you can ask Bob to change the permissions it’s requesting for him in the graph explorer.
Bob will then be presented with a new consent screen, once he presses Ok (not sure what the button says…). Bob will be given a new token, and you should be able to see that in the User Consent tab in the portal.
It also helps to copy the token and paste it at https://jwt.ms which allows an easy overview of all claims (including scopes) in the token.
I tried to reproduce the same in my environment and got the below results:
I registered an Azure AD Application and granted specific
API permissions
required to list users like below:I created a non-admin user
Bob
and assigned the application like below:I tried to list the users via Microsoft Graph Explorer using below query logged in as
Bob
and got the same error:Please note that, even if you granted admin consent in the Azure Portal, it won’t reflect in Graph Explorer. So, you have to consent separately in Graph Explorer for
Bob
.Go to Modify permissions -> User.ReadBasic.All -> Consent-> Accept
I got the response successfully after granting the consent like below:
In your scenario, if
Bob
is unable to request them without the admin consent then try to modify the settings like below:Go to Azure Portal -> Azure Active Directory -> Enterprise Application -> Consent and Permissions -> User consent settings
Make sure to grant consent in Microsoft Graph Explorer based on the query by clicking on Modify permissions tab.
References:
List users – Microsoft Graph v1.0 | Microsoft Docs
Overview of consent and permissions | Microsoft Docs