0
votes

I'm writing a commandline tool to manipulate assets in Azure Media Services using the v3 AMS API. It should authenticate using the logged on user. As the Windows AD and Azure AD are synchronised, it should not need to pop up a login dialog box.

This document: https://docs.microsoft.com/en-us/azure/media-services/latest/access-api-howto?tabs=portal states that it's possible to use either user or service principal authentication to connect to AMS.

In this document: https://docs.microsoft.com/en-us/azure/media-services/latest/configure-connect-dotnet-howto there's an example of how to do service principal authentication but I can't find anything about user authentication. The code in the sample looks something like this:

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)

Note that all constructors of AzureMediaServicesClient take a ServiceClientCredentials object, so how can I authenticate using UserCredentials?

1

1 Answers

2
votes

Azure Media Services Explorer does user based authentication (and SP auth). https://aka.ms/amse

Code for the user based authentication : https://github.com/Azure/Azure-Media-Services-Explorer/blob/master/AMSExplorer/Program.cs#L779-L843