教程:创建 Azure Active Directory B2C 租户Tutorial: Create an Azure Active Directory B2C tenant

必须在你管理的租户中注册应用程序,然后这些应用程序才能与 Azure Active Directory B2C (Azure AD B2C) 交互。Before your applications can interact with Azure Active Directory B2C (Azure AD B2C), they must be registered in a tenant that you manage.

在本文中,学习如何:In this article, you learn how to:

  • 创建 Azure AD B2C 租户Create an Azure AD B2C tenant
  • 将租户链接到订阅Link your tenant to your subscription
  • 切换到包含你的 Azure AD B2C 租户的目录Switch to the directory containing your Azure AD B2C tenant
  • 在 Azure 门户中将 Azure AD B2C 资源添加到收藏夹 Add the Azure AD B2C resource as a Favorite in the Azure portal

在下一个教程中,学习如何注册应用程序。You learn how to register an application in the next tutorial.

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a Trial before you begin.

创建 Azure AD B2C 租户Create an Azure AD B2C tenant

  1. 登录到 Azure 门户Sign in to the Azure portal. 使用 Azure 帐户登录,该帐户至少分配有参与者角色(位于订阅中或订阅的资源组中)。Sign in with an Azure account that's been assigned at least the Contributor role within the subscription or a resource group within the subscription.

  2. 选择包含订阅的目录。Select the directory that contains your subscription.

    在 Azure 门户工具栏中选择“目录 + 订阅”图标,然后选择包含订阅的目录 。In the Azure portal toolbar, select the Directory + Subscription icon, and then select the directory that contains your subscription. 此目录不同于将包含 Azure AD B2C 租户的其他目录。This directory is different from the one that will contain your Azure AD B2C tenant.

    订阅租户,“目录 + 订阅”筛选器,其中已选择订阅租户

  3. 在 Azure 门户菜单或“主页”页上,选择“创建资源” 。On the Azure portal menu or from the Home page, select Create a resource.

  4. 搜索“Azure Active Directory B2C” ,然后选择“创建” 。Search for Azure Active Directory B2C, and then select Create.

  5. 选择“创建新的 Azure AD B2C 租户”。 Select Create a new Azure AD B2C Tenant.

    已在 Azure 门户中选择“创建新的 Azure AD B2C 租户”

  6. 输入组织名称初始域名Enter an Organization name and Initial domain name. 选择国家或地区(以后不能更改),然后选择“创建”。 Select the Country or region (it can't be changed later), and then select Create.

    域名将用作完整租户域名的一部分。The domain name is used as part of your full tenant domain name. 在此示例中,租户名称是 contosob2c.partner.onmschina.cnIn this example, the tenant name is contosob2c.partner.onmschina.cn:

    Azure 门户中包含示例值的“创建租户”窗体

  7. 租户创建过程完成后,请在租户创建页面的顶部选择“创建新的 B2C 租户或链接到现有租户”链接。 Once the tenant creation is complete, select the Create new B2C Tenant or Link to existing Tenant link at the top of the tenant creation page.

    Azure 门户中突出显示的“链接租户”痕迹导航链接

  8. 选择“将现有 Azure AD B2C 租户链接到我的 Azure 订阅”。 Select Link an existing Azure AD B2C Tenant to my Azure subscription.

    Azure 门户中“链接现有订阅”的选项

  9. 选择创建的 Azure AD B2C 租户,然后选择你的订阅Select the Azure AD B2C Tenant that you created, then select your Subscription.

    对于“资源组” ,选择“新建” 。For Resource group, select Create new. 输入要包含该租户的资源组的名称,选择资源组位置,然后选择“创建”。 Enter a Name for the resource group that will contain the tenant, select the Resource group location, and then select Create.

    Azure 门户中的“链接订阅”设置窗体

    出于计费目的,可以将多个 Azure AD B2C 租户链接到单个 Azure 订阅。You can link multiple Azure AD B2C tenants to a single Azure subscription for billing purposes.

选择 B2C 租户目录Select your B2C tenant directory

若要开始使用新的 Azure AD B2C 租户,需要切换到包含该租户的目录。To start using your new Azure AD B2C tenant, you need to switch to the directory that contains the tenant.

在 Azure 门户的顶部菜单中选择“目录 + 订阅”筛选器,然后选择包含你的 Azure AD B2C 租户的目录。 Select the Directory + subscription filter in the top menu of the Azure portal, then select the directory that contains your Azure AD B2C tenant.

如果最初在列表中未看到新的 Azure B2C 租户,请刷新浏览器窗口,然后再次在顶部菜单中选择“目录+订阅”筛选器 。If at first you don't see your new Azure B2C tenant in the list, refresh your browser window, then select the Directory + subscription filter again in the top menu.

已在 Azure 门户中选择包含 B2C 租户的目录

将 Azure AD B2C 添加到收藏夹(可选)Add Azure AD B2C as a favorite (optional)

使用此可选步骤可以更轻松地在所有后续教程中选择 Azure AD B2C 租户。This optional step makes it easier to select your Azure AD B2C tenant in the following and all subsequent tutorials.

如果不希望每次使用租户时都要在“所有服务”中搜索“Azure AD B2C”,可将该资源加入收藏夹。 Instead of searching for Azure AD B2C in All services every time you want to work with your tenant, you can instead favorite the resource. 以后,可以从门户菜单的“收藏夹”部分选择该资源,以快速浏览到你的 Azure AD B2C 租户。 Then, you can select it from the portal menu's Favorites section to quickly browse to your Azure AD B2C tenant.

只需执行此操作一次。You only need to perform this operation once. 在执行这些步骤之前,请确保已根据上一部分选择 B2C 租户目录中所述切换到包含你的 Azure AD B2C 租户的目录。Before performing these steps, make sure you've switched to the directory containing your Azure AD B2C tenant as described in the previous section, Select your B2C tenant directory.

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 在 Azure 门户菜单中,选择“所有服务” 。In the Azure portal menu, select All services.

  3. 在“所有服务” 搜索框中,搜索“Azure AD B2C” ,将鼠标悬停在搜索结果上,然后在工具提示中选择星形图标。In the All services search box, search for Azure AD B2C, hover over the search result, and then select the star icon in the tooltip. “Azure AD B2C”现在会显示在 Azure 门户中的“收藏夹”下。 Azure AD B2C now appears in the Azure portal under Favorites.

  4. 如果要更改新收藏的位置,请转到 Azure 门户菜单,选择“Azure AD B2C” ,然后将其上移或下移到所需的位置。If you want to change the position of your new favorite, go to the Azure portal menu, select Azure AD B2C, and then drag it up or down to the desired position.

    Azure AD B2C、“收藏夹”菜单、Azure 门户

后续步骤Next steps

本文介绍了如何执行以下操作:In this article, you learned how to:

  • 创建 Azure AD B2C 租户Create an Azure AD B2C tenant
  • 将租户链接到订阅Link your tenant to your subscription
  • 切换到包含你的 Azure AD B2C 租户的目录Switch to the directory containing your Azure AD B2C tenant
  • 在 Azure 门户中将 Azure AD B2C 资源添加到收藏夹 Add the Azure AD B2C resource as a Favorite in the Azure portal

接下来,了解如何在新租户中注册 Web 应用程序。Next, learn how to register a web application in your new tenant.