0

I am developing a backend in node express where I use the passport-azure-ad library to protect the routes of my api, is there any way to access the roles defined in Azure Ad for the application and validate them in the routes?

Ema
  • 27
  • 5

1 Answers1

0

To achieve the above requirement you may need to follow the below workaround.

We can get our Azure AD log details by using MS GRAPH Programmatically

SAMPLE CODE:-

const options = {
    authProvider,
};

const client = Client.init(options);

let directoryAudit = await client.api('/auditLogs/directoryAudits/{id}')
    .get();

Also you can get roles which has assigned in Azure AD by using below MS GRAPH query in your code.

GET /users/{id | userPrincipalName}/appRoleAssignments

For complete setup please refer the below links:

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15