通过 Azure 门户开始使用 Azure AD 身份验证Get started with Azure AD authentication by using the Azure portal

Note

不会向媒体服务 v2 添加任何新特性或新功能。No new features or functionality are being added to Media Services v2.
查看最新版本:媒体服务 v3Check out the latest version, Media Services v3. 另请参阅从 v2 到 v3 的迁移指南Also, see migration guidance from v2 to v3

了解如何使用 Azure 门户访问 Azure Active Directory (Azure AD) 身份验证设置,以便使用 Azure 媒体服务 API。Learn how to use the Azure portal to access Azure Active Directory (Azure AD) authentication to access the Azure Media Services API.

必备条件Prerequisites

将 Azure AD 身份验证与 Azure 媒体服务结合使用时,可以选择下列两个身份验证选项:When you use Azure AD authentication with Azure Media Services, you have two authentication options:

  • 服务主体身份验证Service principal authentication. 验证服务。Authenticate a service. 常常使用这种身份验证方法的应用程序是运行守护程序服务、中间层服务或计划作业的应用程序:Web 应用程序、函数应用程序、逻辑应用程序、API 或微服务。Applications that commonly use this authentication method are apps that run daemon services, middle-tier services, or scheduled jobs: web apps, function apps, logic apps, APIs, or a microservice.
  • 用户身份验证User authentication. 验证使用应用程序与媒体服务资源进行交互的用户。Authenticate a person who is using the app to interact with Media Services resources. 交互式应用程序应先提示用户输入凭据。The interactive application should first prompt the user for credentials. 例如,授权用户用来监视编码作业或实时传送视频流的管理控制台应用程序。An example is a management console app used by authorized users to monitor encoding jobs or live streaming.

访问媒体服务 APIAccess the Media Services API

可以通过此页选择需要用来连接到 API 的身份验证方法。This page lets you select the authentication method you want to use to connect to the API. 此页还提供连接到 API 所需的值。The page also provides the values you need to connect to the API.

  1. Azure 门户中,选择媒体服务帐户。In the Azure portal, select your Media Services account.
  2. 选择与媒体服务 API 的连接方式。Select how to connect to the Media Services API.
  3. 在“连接到媒体服务 API”下,选择要连接到的媒体服务 API 版本。 Under Connect to Media Services API, select the Media Services API version you want to connect to.

使用 Azure Active Directory (Azure AD) 应用和机密对服务进行身份验证。Authenticates a service using an Azure Active Directory (Azure AD) app and secret. 建议对调用媒体服务 API 的所有中间层服务执行此操作。This is recommended for any middle-tier services calling to the Media Services API. 例如,Web 应用、Functions、逻辑应用、API 和微服务。Examples are Web Apps, Functions, Logic Apps, APIs, and microservices. 这是推荐使用的身份验证方法。This is the recommended authentication method.

管理 Azure AD 应用和机密Manage your Azure AD app and secret

在“管理 AAD 应用和机密”部分,可以选择或新建 Azure AD 应用并生成机密。 The Manage your AAD app and secret section lets you select or create a new Azure AD app and generate a secret. 出于安全方面的原因,关闭边栏选项卡后,无法显示机密。For security purposes, the secret cannot be shown after the blade is closed. 应用程序使用应用程序 ID 和机密进行身份验证,以获取媒体服务的有效令牌。The application uses the application ID and secret for authentication to obtain a valid token for media services.

务必拥有足够的权限,以便向 Azure AD 租户注册应用程序,并将应用程序分配给 Azure 订阅中的角色。Make sure that you have sufficient permissions to register an application with your Azure AD tenant and to assign the application to a role in your Azure subscription. 有关详细信息,请参阅所需权限For more information, see Required permissions.

连接到媒体服务 APIConnect to Media Services API

“连接到媒体服务 API”提供用于连接服务主体应用程序的值。 The Connect to Media Services API provides you with values that you use to connect your service principal application. 可以获取文本值,或者复制 JSON 或 XML 块。You can get text values or copy the JSON or XML blocks.

用户身份验证User authentication

此选项可用于对某个使用应用来与媒体服务资源交互的 Azure Active Directory 员工或成员进行身份验证。This option could be used to authenticate an employee or member of an Azure Active Directory who is using an app to interact with Media Services resources. 交互式应用程序应先提示用户输入用户凭据。The interactive application should first prompt the user for the user's credentials. 此身份验证方法只可用于管理型应用程序。This authentication method should only be used for Management applications.

连接到媒体服务 APIConnect to Media Services API

从“连接到媒体服务 API”部分复制用于连接用户应用程序的凭据 。Copy your credentials to connect your user application from the Connect to Media Services API section. 可以获取文本值,或者复制 JSON 或 XML 块。You can get text values or copy the JSON or XML blocks.

后续步骤Next steps

开始将文件上传到帐户Get started with uploading files to your account.