快速入门:将应用程序注册到 Microsoft 标识平台Quickstart: Register an application with the Microsoft identity platform

在本快速入门中,我们使用 Azure 门户中的“应用注册” 体验注册应用程序。In this quickstart, you register an application using the App registrations experience in the Azure portal.

将应用与 Microsoft 标识平台集成的方法是将其注册到 Azure Active Directory 租户。Your app is integrated with the Microsoft identity platform by registering it with an Azure Active Directory tenant. 企业开发人员可以开发能够与 Microsoft 标识平台集成的商业云服务或业务线应用程序。Enterprise developers can develop commercial cloud services or line-of-business applications that can be integrated with Microsoft identity platform. 集成为此类服务提供安全的登录和授权。Integration provides secure sign-in and authorization for such services.

先决条件Prerequisites

使用 Azure 门户注册新应用程序Register a new application using the Azure portal

  1. 使用工作或学校帐户登录到 Azure 门户Sign in to the Azure portal using a work or school account.

  2. 如果帐户有权访问多个租户,请在右上角选择该帐户。If your account gives you access to more than one tenant, select your account in the upper right corner. 将门户会话设置为所需的 Azure AD 租户。Set your portal session to the Azure AD tenant that you want.

  3. 搜索并选择“Azure Active Directory” 。Search for and select Azure Active Directory. 在“管理” 下,选择“应用注册” 。Under Manage, select App registrations.

  4. 选择“新注册”。 Select New registration.

  5. 在“注册应用程序” 中,输入一个要向用户显示的有意义的应用程序名称。In Register an application, enter a meaningful application name to display to users.

  6. 指定可使用应用程序的用户,如下所示:Specify who can use the application, as follows:

    支持的帐户类型Supported account types 说明Description
    仅此组织目录中的帐户Accounts in this organizational directory only 若要生成业务线 (LOB) 应用程序,请选择此选项。Select this option if you're building a line-of-business (LOB) application. 如果不在目录中注册应用程序,则此选项不可用。This option isn't available if you're not registering the application in a directory.

    此选项映射到仅限 Azure AD 的单租户。This option maps to Azure AD only single-tenant.

    此选项是默认选项,除非你是在目录外部注册应用。This option is the default unless you're registering the app outside of a directory. 如果在目录外部注册应用,则默认设置为 Azure AD 多租户。In cases where the app is registered outside of a directory, the default is Azure AD multi-tenant.
    任何组织目录中的帐户Accounts in any organizational directory 若要面向所有企业和教育客户,请选择此选项。Select this option if you would like to target all business and educational customers.

    此选项映射到仅限 Azure AD 的多租户。This option maps to an Azure AD only multi-tenant.

    如果已将应用注册为仅限 Azure AD 的单租户,则可通过“身份验证”页将其更新为 Azure AD 多租户,以及从多租户更新为单租户。 If you registered the app as Azure AD only single-tenant, you can update it to be Azure AD multi-tenant and back to single-tenant through the Authentication page.
  7. 在“重定向 URI (可选)” 下,选择要生成的应用的类型:“Web”或“公共客户端(移动和桌面)”。 Under Redirect URI (optional), select the type of app you're building: Web or Public client (mobile & desktop). 然后,输入应用程序的重定向 URI 或回复 URL。Then enter the redirect URI, or reply URL, for your application.

    • 对于 Web 应用程序,请提供应用的基 URL。For web applications, provide the base URL of your app. 例如,https://localhost:31544 可以是本地计算机上运行的 Web 应用的 URL。For example, https://localhost:31544 might be the URL for a web app running on your local machine. 用户将使用此 URL 登录到 Web 客户端应用程序。Users would use this URL to sign in to a web client application.
    • 对于公共客户端应用程序,请提供 Azure AD 返回令牌响应时所用的 URI。For public client applications, provide the URI used by Azure AD to return token responses. 输入特定于应用程序的值,例如 myapp://authEnter a value specific to your application, such as myapp://auth.

    如需 Web 应用程序或本机应用程序的示例,请参阅 Microsoft 标识平台中的快速入门。For examples for web applications or native applications, see the quickstarts in Microsoft identity platform.

  8. 完成后,选择“注册” 。When finished, select Register.

    显示了在 Azure 门户中注册新应用程序的屏幕

Azure AD 会向应用分配唯一的应用程序 ID 或客户端 ID。Azure AD assigns a unique application, or client, ID to your app. 门户会打开应用程序的“概览”页。 The portal opens your application's Overview page. 若要向应用程序添加功能,可以选择其他配置选项,包括品牌、证书和机密、API 权限等。To add capabilities to your application, you can select other configuration options including branding, certificates and secrets, API permissions, and more.

新注册应用的概览页示例

后续步骤Next steps