How do I limit access to API endpoints if a logged in user does not have an admin role

Nicolas Ranz 0 Reputation points
2024-09-19T19:43:47.25+00:00

I'm creating an employee management application and I registered my app and have given the application delegated api access to Microsoft Graph Directory.AccessAsUser.all. I would like to restrict access to this api endpoint if the logged in user does not have admin permissions.

I don't think this matters but just in case, its an angular application, and I have used MSAL for authentication of users.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,882 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,450 questions
0 comments No comments
{count} votes

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.