如何允许 public 登录我的 Azure 租户中的应用程序注册?

How can I allow public login on my app registration in my Azure Tenant?

我正在尝试创建一个托管在 Azure 中的应用程序,只要您拥有 Microsoft 帐户,它(应该)允许 public 登录。我不在乎它是企业帐户还是个人帐户。您只需要能够登录即可。我正在创建一个 SPA 和一个 API.

所以我转到 Azure 门户并创建了一个应用程序注册,并将应用程序注册配置为允许组织内部或外部的所有用户使用有效的个人或企业 Microsoft 帐户。

现在 SPA 是一个 Angular 应用程序,我使用 Damien Bod 的 OpenId 库登录。当我将 stsServer 指向我的登录端点 (https://login.microsoftonline.com/{my-tenant-id}/v2.0) 并登录时,一切正常,除非我使用组织外的帐户登录(例如我的个人帐户)。

我收到以下错误:

AADSTS50020: User account 'xxxx@xxxx.xxx' from identity provider 'https://sts.windows.net/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/' does not exist in tenant 'Default Directory' and cannot access the application 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'(App Name) 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.

现在的问题是我根本不想添加所有这些用户,而是允许他们访问此应用程序。我该怎么做?

非常感谢!

如果您想允许任何帐户登录,则不能使用您的 tenant-specific 登录端点。 您需要使用“通用”端点:https://login.microsoftonline.com/common/v2.0。 这允许使用任何 Azure AD / 个人 Microsoft 帐户登录。