Microsoft Secure Tech Accelerator
Apr 03 2024, 07:00 AM - 11:00 AM (PDT)
Microsoft Tech Community

Combining a multi-tenant application with B2B guest users

Iron Contributor

We have set-up a multi-tenant application so that users having a presence in the Azure AD tenants can login seamlessly, after a global admin gives the consent at once. However, due to the nature and the audience of the Web Application we are offering, we need also to grant access, from time to time, to B2B guest users that we invite in our tenant through a registration process based on Graph API.

Here is where the issues are coming as, we experienced that depending on the domain guest users are belonging to they can or cannot sign-in into the application.

For example guest B2B users belonging to @gmail.com are successfully logged in while users belonging to @Libero.it are not.

We came to understand that @Libero.it has a presence in the Azure AD Directory then, if we're right, a global admin in that tenant should give consent at once to our application, unfortunately this is not a feasible solution for our objectives as we will have an heterogeneous population of guest users and it would not be manageable to contact each single global admin to request consent (i.e. for two or three users)...could it be possible instead for each single user to grant such permission only for his account?

 

Being a multi-tenant application we are using the /common endpoint to get the authentication token, suggestions?

 

Many thanks in advance for reading it

 

Giuseppe

 

5 Replies

 

Hello Giuseppe,

 

Let me take this step by step and I hope I will be able to explain. 

 

- You have a mutlitenant application which needs a authentication token from Azure AD. 

- once your application has the token your application can perform the required tasks.

 

As you also stated about the two domains gmail.com and libero.it, I will explain what happens from azure ad standpoint.

 

If a user from gmail.com or outlook.com will access your application, for the very first time they will  receive a consent prompt to approve the application authorization and after which it will work for sure because they are the owner of their own data.

 

Also, now it completely depends upon the scope that you are using while sending the authentication request to AAD for enterprise accounts.

I agree you are requesting basic profile which should work as expected, but when it comes to graph the process is entirely different. 

 

If your application is trying to access a protected resource through graph api which requires admin consent, users will not be able to approve because it is a change that is happening at the directory level.

In azure AD every object has to be authenticated by its home tenant i.e., where the user object resides.

 

Common auth flow for your scenario.

 

Your application ------ authentication request ----> login.microsoftonline.com --> user will type upn ----> will be redirected to the instance of the AzureAD where the user object resides ------>> Note this request will contain the scope binded by your application. 

 

Now once the user is authenticated,  azure AD has to check whether your application is authorized to access the protected resource via graph --- for which it needs a service principal.

 

Whenever any application is consented by the global admin a service principal object is created, which is listed in the enterprise application column of azure active directory. 

This service principal is responsible for all the consent and oauth delegation bindings.

 

So, if you are using graph to access something which requires admin consent. this will be by design behavior.

Please do check about the details of the scope that is getting requested for accessing every protected resource.

Ignore if duplicate.

 

Regards,

Rishabh

Hi Giuseppe, I have the same problem. One of my customers uses AAD login for the B2B Website authentication. Guest users at @Libero.it are unable to reset their password. Have you found a solution?

Hi @gabrieligm , it really depends on your specific setup. When it's about a tenant with B2B actually the user @libero.it defined as guest has his password defined in your tenant and you can reset it. When it's about a B2C it might be that you have as trusted identity provider another tenant. Simply go to the list of users, select the @libero account of your concern and notice how it is done...if it is something such as nameoftheuser_libero.it@#EXT#@nameofyourtenant.onmicrosoft.com you can then reset the password. Guest users can as well however make sure that Self Service Password Reset Portal is enabled 

guest users are nameoftheuser_libero.it@#EXT#@nameofyourtenant.onmicrosoft.com and the nameofyourtenant admin is unable to change reset the password.
@gabrieligm you can't directly reset a password for a guest user who signs in with an account that's managed by another Azure AD directory or external identity provider. Only the guest user or an administrator in the user's home directory can reset the password