Hi Nicolas Ranz,
Thank you for reaching out, Microsoft!
Delegated permissions in Microsoft Graph allow the application to act on behalf of the signed-in user, and the user must have the necessary permissions to access the resources. If the user does not have admin permissions, they won’t be able to access the Directory.AccessAsUser.All endpoint. You can rely on the built-in permission model to restrict access. However, if you want to add an extra layer of validation within your application, you can still check the user’s roles using the Microsoft Graph API /memberOf endpoint to get the groups and directory roles the user is a member of.
Please refer the below screenshot where one user is admin and able to access directoryObject and the other is user who is not admin is not able to consent the **Directory.AccessAsUser.All **as it Admin consent.
For more details, on permissions please refer below docs:
https://learn.microsoft.com/en-us/graph/permissions-reference#directoryaccessasuserall
https://learn.microsoft.com/en-us/graph/auth/auth-concepts#delegated-access-access-on-behalf-of-a-user
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.