Home > database >  Log-in via Microsoft for personal AND for any Azure ADs
Log-in via Microsoft for personal AND for any Azure ADs

Time:03-17

I have created a webapp on Azure and have set the authentication mode to;

"Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)

All users with a work or school, or personal Microsoft account can use your application or API. This includes Office 365 subscribers."

It works perfectly for me and my colleges, and it works also for personal Microsoft accounts.

I am now trying to login users on a different Azure AD, but these cannot login. Here is the login log of an attempt taken from their AD. A similar message was displayed to the user onscreen

User account '{email}' from identity provider '{idp}' does not exist in tenant '{tenant}' and cannot access the application '{appId}'({appName}) in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account.

the sole purpose of the webapp is to get an Azure/MS verified email address of the user and perform a lookup in a user database.

Preferably this should be achieved without need the "other azure AD" admins to do anything on their end. But if need be this can be asked. I just don't know what to ask.

CodePudding user response:

User account '{email}' from identity provider '{idp}' does not exist in tenant '{tenant}' and cannot access the application '{appId}'({appName}) in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account.

This error usually occurs for many reasons. Please check if below are helpful:

Case1:

Please check if your sign-in URL is something like this:

https://login.microsoftonline.com/<tenant_id>/

If it is like that, you may get error as you selected this option: “Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g., Skype, Xbox)” and users from other organizations can't access the application.

To resolve that error, try to change the sign-in URL as https://login.microsoftonline.com/common

Apply this URL value in Authority Setting in your application code.

To know how to do that in detail, go through this link.

Case2:

There is also a possibility where the user has active session already signed in using different personal account other than Microsoft. To confirm this scenario, check User Account and Identity Provider values in error message.

To resolve that error, inform the user to sign out from their active session and sign in again from different browser or private browser session. Otherwise ask them to clear the cookies and cache, sign in as new.

If still the error won’t resolve means, please go through below reference if it is helpful.

Reference:

Error AADSTS50020 - User account from identity provider does not exist in tenant - Active Directory | Microsoft Docs

  • Related