通过 Microsoft 登录个人和任何 Azure 广告

Log-in via Microsoft for personal AND for any Azure ADs

我在 Azure 上创建了一个 webapp 并将身份验证模式设置为;

"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."

它非常适合我和我的大学,也适用于个人 Microsoft 帐户。

我现在正尝试在不同的 Azure AD 上登录用户,但这些用户无法登录。这是从他们的广告中获取的尝试登录日志。屏幕上向用户显示了类似的消息

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.

Web 应用程序的唯一目的是获取 Azure/MS 已验证的用户电子邮件地址并在用户数据库中执行查找。

最好这应该在不需要“其他 azure AD”管理员自己做任何事情的情况下实现。但如果需要,可以询问。就是不知道问什么好

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.

出现此错误的原因通常有很多。请检查以下内容是否有帮助:

案例 1:

请检查您的 sign-in URL 是否是这样的:

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

如果是这样,您在选择此选项时可能会出错:“任何组织目录中的帐户(任何 Azure AD 目录 - Multitenant)和个人 Microsoft 帐户(例如 Skype、Xbox )” 并且来自其他组织的用户无法访问该应用程序。

要解决该错误,请尝试将 sign-in URL 更改为 https://login.microsoftonline.com/common

在您的应用程序代码中的 权限设置 中应用此 URL 值。

要详细了解如何执行此操作,请查看此 link

案例2:

也有可能用户已经使用不同的个人帐户而不是 Microsoft 登录了活动会话。要确认这种情况,请检查错误消息中的 User AccountIdentity Provider 值。

要解决该错误,请通知用户从他们的活动会话中注销,然后从不同的浏览器或私人浏览器会话中重新登录。否则要求他们清除 cookie 和缓存,以新身份登录。

如果错误仍然无法解决,请参考以下内容,如果有帮助的话。

参考:

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