我需要使用用户身份验证连接到Azure Media Services



我正在编写一个命令行工具,以使用v3 AMS API操作Azure Media Services中的资产。它应该使用登录的用户进行身份验证。由于Windows AD和Azure AD是同步的,因此不需要弹出登录对话框。

本文件:https://learn.microsoft.com/en-us/azure/media-services/latest/access-api-howto?tabs=portal声明可以使用用户或服务主体身份验证来连接到AMS。

在本文件中:https://learn.microsoft.com/en-us/azure/media-services/latest/configure-connect-dotnet-howto这里有一个如何进行服务主体身份验证的示例,但我找不到任何关于用户身份验证的信息。示例中的代码如下所示:

var clientCredential = new ClientCredential(config.AadClientId, config.AadSecret);
var credentials = await ApplicationTokenProvider.LoginSilentAsync(config.AadTenantId, clientCredential, ActiveDirectoryServiceSettings.Azure);
var amsClient = new AzureMediaServicesClient(config.ArmEndpoint, credentials)

请注意,AzureMediaServicesClient的所有构造函数都使用ServiceClientCredentials对象,那么我如何使用UserCredentials进行身份验证呢?

Azure Media Services Explorer执行基于用户的身份验证(和SP身份验证(。https://aka.ms/amse

基于用户的身份验证的代码:https://github.com/Azure/Azure-Media-Services-Explorer/blob/master/AMSExplorer/Program.cs#L779-L843

最新更新