快速入门:设置开发环境Quickstart: Set up a dev environment

租户是组织的表示形式。A tenant is a representation of an organization. 它是 Azure AD 专用实例,组织或应用开发人员与 Microsoft 建立关系时(例如注册 Azure 或 Microsoft 365)会收到该实例。It's a dedicated instance of Azure AD that an organization or app developer receives when the organization or app developer creates a relationship with Microsoft-- like signing up for Azure or Microsoft 365.

每个 Azure AD 租户都与其他 Azure AD 租户不同并单独存在,而且使用自己的工作和学校标识以及应用注册进行表示。Each Azure AD tenant is distinct and separate from other Azure AD tenants and has its own representation of work and school identities and app registrations. 租户内部的应用注册只允许从租户或所有租户的帐户中进行身份验证。An app registration inside of your tenant can allow authentications from accounts only within your tenant or all tenants.

工作和学校帐户或个人 Microsoft 帐户Work and school accounts, or personal Microsoft accounts

使用现有租户Use an existing tenant

许多开发人员已通过绑定到 Azure AD 租户的服务或订阅(例如 Microsoft 365 或 Azure 订阅)获得了租户。Many developers already have tenants through services or subscriptions that are tied to Azure AD tenants such as Microsoft 365 or Azure subscriptions.

  1. 要检查租户,请使用要用于管理应用程序的帐户登录 Azure 门户To check the tenant, sign in to the Azure portal with the account you want to use to manage your application.
  2. 查看右上角。Check the upper right corner. 如果你有一个租户,则会自动登录到该租户,并且帐户名的正下方会显示租户名称。If you have a tenant, you'll automatically be logged in and can see the tenant name directly under your account name.
    • 将鼠标指针悬停在 Azure 门户右上角的帐户名上,可以查看你的姓名、电子邮件、目录和租户 ID (GUID) 以及域。Hover over your account name on the upper right-hand side of the Azure portal to see your name, email, directory / tenant ID (a GUID), and your domain.
    • 如果帐户与多个租户相关联,则可以选择帐户名打开一个菜单,并在其中切换租户。If your account is associated with multiple tenants, you can select your account name to open a menu where you can switch between tenants. 每个租户都有自己的唯一租户 ID。Each tenant has its own tenant ID.

Tip

如果需要查找租户 ID,可执行以下操作:If you need to find the tenant ID, you can:

  • 将鼠标指针悬停在帐户名上以获取目录/租户 ID,或Hover over your account name to get the directory / tenant ID, or
  • 在 Azure 门户中选择“Azure Active Directory”>“属性”>“目录 ID”Select Azure Active Directory > Properties > Directory ID in the Azure portal

如果没有任何与帐户关联的现有租户,则帐户名下面会显示一个 GUID;另外,除非按照下一节的步骤操作,否则无法执行注册应用等操作。If you don't have an existing tenant associated with your account, you'll see a GUID under your account name and you won't be able to perform actions like registering apps until you follow the steps of the next section.

创建新的 Azure AD 租户Create a new Azure AD tenant

如果还没有 Azure AD 租户或想要为开发创建新租户,请遵循目录创建体验If you don't already have an Azure AD tenant or want to create a new one for development, follow the directory creation experience. 必须提供以下信息才能创建新租户:You will have to provide the following info to create your new tenant:

  • 组织名称Organization name
  • 初始域 - 这将是 *.partner.onmschina.cn 的一部分。Initial domain - this will be part of *.partner.onmschina.cn. 稍后你可以更详细地自定义域。You can customize the domain more later.
  • 国家或地区Country or region

Note

对租户进行命名时,请使用字母数字字符。When naming your tenant, use alphanumeric characters. 不允许使用特殊字符。Special characters are not allowed. 名称不得超过 256 个字符。The name must not exceed 256 characters.

后续步骤Next steps

  • 尝试编写快速入门代码并开始对用户进行身份验证。Try a coding quickstart and begin authenticating users.
  • 有关更多深入的代码示例,请参阅文档的“教程”部分。For more in-depth code samples, check out the Tutorials section of the documentation.