教程:创建 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.

先决条件Prerequisites

如果没有 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 :

  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. 需要以所有者角色的身份登录才能执行此步骤。You need to be logged in as owner role to perform this step.

    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. 若要链接租户,你必须是 Azure AD B2C 租户中的管理员,并且在 Azure 订阅中分配有至少一个参与者角色。To link a tenant, you must be an admin in the Azure AD B2C tenant and be assigned at least a Contributor role within the Azure subscription. 请参阅将 Azure AD B2C 租户链接到订阅See Link an Azure AD B2C tenant to a subscription.

选择 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. 在执行这些步骤之前,确保已切换到包含 Azure AD B2C 租户的目录,如前一节选择 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.