简体   繁体   中英

How to aggregate multiple Azure AD users data with data from backend?

I am developing new application (.NET Core backend + React frontend) and I want to integrate Azure AD to do auth things inside my organization tenant.

Some models has the "author" property containing Object ID from access token (like in typical scenario with "user" table). Now, the main problem is that we will need to display at least first name + last name of the "author" on multiple views containing list of resource but on the backend, we have only "AuthorID".

How should I handle that kind of "aggregation" with azure ad? Should I somehow synchronize that specific user which is needed (like on resource creating) to local "users" table? Maybe call the user by ID on frontend with MS Graph?

Any advice would be very helpful.

Nothing at all, just looking for some advices.

Using Microsoft Graph Explorer, you can call the user by ID and can display multiple attributes. By using the below query,

GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}

在此处输入图像描述

To know more in detail, refer link

Using PowerShell, you can call the user by ID and can display multiple attributes. By using the below command,

Get-AzureADUser -ObjectID "xxxxxxxx" | Select-Object ObjectId, GivenName,Surname,UserType

在此处输入图像描述

To know more in detail, refer link

For multiple users you can loop through each user by getting list of users required.

Ref1: Get list of users

Ref2: Get list of users

Also Refer: https://www.codeproject.com/tips/991663/displaying-user-full-name-instead-of-user-email-in

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM