3
votes

I have a case where I need to list all Azure Active Directories I'm a member of and those I'm invited as a guest user to. Our application is multi-tenant where each tenant have their own Azure Active Directory, and one user can be invited to access the application as another tenant, and should be presented with a UI to switch between tenants/directories like we can do in the Azure Portal.

The first part can be queried using the Azure Resource Manager API for listing tenants which I'm a member of (https://docs.microsoft.com/en-us/rest/api/resources/tenants/list). The response from this API do not include tenants for which I'm only invited as a guest user to though.

Are there any API's that I can call with an access token to query for all Azure Active Directories I have guest access to?

Btw: I'm able to switch between the directories I'm a member of seamlessly using the ng2-adal library, by explicitly setting the tenant in the ADAL configuration object and invoking login() on the ADAL service.

Update: The answer to my question is that guests must complete the invitation process by following the link in the e-mail that they receive from Azure Ad.

1

1 Answers

1
votes

Are there any API's that I can call with an access token to query for all Azure Active Directories I have guest access to?

Of course you can!

For your case, I also test in my lab with an account that federated from on-premise and Succeeded. So, You it seems like your account is not working in the second tenant.

You can use code grant flow with Azure REST API or implict flow to get access token with has delegated permissions for your account.

I did a test and succeeded:

enter image description here

Hope this helps!