May 17 2018
- last edited on
Jul 27 2020
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
May 31 2018 09:59 AM
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.