Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graph API requests for guest users in Azure AD

I wanted to know how can we make graph API calls for guest users in Azure AD. I am able to achieve it for internal users using the API examples given here but the same calls are not working on guest user. Is there any difference in the way the requests need to be made?

like image 490
adarsh hegde Avatar asked Feb 07 '17 16:02

adarsh hegde


1 Answers

Guest accounts in your tenant will have a different user principal name than the UPN they have in their home tenant. You should be able to see evidence of this by querying all the users in your tenant, and finding the external users which have a 'modified' user principal name, usually with "EXT".

You can see a direct example of this in our Demo Tenant here

"userPrincipalName": "djayachandran.cw_mmm.com#EXT#@GraphDir1.onmicrosoft.com",

It seems like you will need to query for these users using other properties where their old UPN is not changed, like the 'mail' property. Ultimately, you want to find the ObjectId of the user you are interested in, and use that as your key to find the user information. You should be able to get the object id from the token of the signed in user.

Let me know if this helps! Thanks, Shawn Tabrizi

like image 161
Shawn Tabrizi Avatar answered Nov 06 '22 06:11

Shawn Tabrizi