How to setup "Login with Microsoft" for my application for all users?

konstantin.kostadinov 0 Reputation points
2023-07-03T13:34:02.91+00:00

I want every user with Microsoft account to be able to log in to my application. I get this error message: "Selected user account does not exist in tenant 'MY ORG' and cannot access the application 'xxx' in that tenant. The account needs to be added as an external user in the tenant first. Please use a different account."

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,752 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Akshay-MSFT 17,916 Reputation points Microsoft Employee
    2023-07-05T12:14:23.12+00:00

    @konstantin.kostadinov

    Thank you for posting your query on Microsoft Q&A, from above description it seems like you want to allow all personal and AAD users from different tenant to be able to access your application hosted in Azure AD, without registering them manually as Guest accounts.

    Please do let me know if this is not the case by responding to this in the comments section.

    • The ideal way here would be using Azure AD self-service sign-up user flow. (can't be used with native Azure AD/Microsoft applications)
    • The user can sign in to your application, via the web, mobile, desktop, or single-page application (SPA). The application initiates an authorization request to the user flow-provided endpoint. The user flow defines and controls the user's experience. When the user completes the sign-up user flow, Azure AD generates a token and redirects the user back to your application. Upon completion of sign-up, a guest account is provisioned for the user in the directory. Multiple applications can use the same user flow.
    • I created one user flow in my tenant, PFB examples :

    User's image

    • I added my test application to the user flow:

    User's image

    • Now anytime I access the application it does give me option to sign-up with my personal account to the tenant in which the application has been setup.

    User's image

    • Enter your domain on which application has been hosted.

    User's image

    • This takes me to the application hosted domain.

    User's image

    • This would take redirect live.com auth page for personal accounts authentication:

    User's image

    • Once authenticated Consent screen would pop up:

    User's image

    • Then information requested by admin in user flow would be presented.

    User's image

    • Now my account has been added as guest and end users could access the application without me adding them as guest account via self-service user flow:

    User's image

    Please do let me know if you have any further queries.

    Thanks,

    Akshay Kaushik

    Please "Accept the answer" (Yes), and share your feedback if the suggestion answers you’re your query. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.