.netazurerestazure-media-services

Azure Media Service authentication type


Azure Media Service is deprecating the Access Control service-based authentication in favor of AAD authentication (more info: https://azure.microsoft.com/en-us/blog/azure-media-service-aad-auth-and-acs-deprecation/). However, I'm not really sure which type of authentication I'm currently using and whether or not I will be affected by the deprecation.

This is how I currently authenticate to Azure Media Service. Is this AAD or Access Control authentication?

CloudMediaContext mediaContext = new CloudMediaContext(AMSAccountName, AMSAccountKey);
var asset = mediaContext.Assets.Create(fileName, AssetCreationOptions.None);

Solution

  • This is how I currently authenticate to Azure Media Service. Is this AAD or Access Control authentication?

    You could get the answer from the document, you are using the ACS token authentication model ("account keys"). Microsoft Azure Media Services will end support for Microsoft Azure Access Control Service (ACS)-based authentication on June 22, 2018

    we strongly recommend that you update your code and migrate from ACS to AAD-based authentication by June 22, 2018.

    New way of authenticating with an AAD Service Principal and client

    var tokenCredentials = new AzureAdTokenCredentials("{YOUR AAD TENANT DOMAIN HERE}", new AzureAdClientSymmetricKey("{YOUR CLIENT ID HERE}", {YOUR CLIENT SECRET}"), AzureEnvironments.AzureCloudEnvironment);
    var tokenProvider = new AzureAdTokenProvider(tokenCredentials);
    var mediaContext = new CloudMediaContext(_mediaServicesApiServerUri, tokenProvider);
    mediaContext.Assets.FirstOrDefault();
    

    How to registry an app in the Azure AD and create service principal for accessing the resource. For more detail information, please refer to the document. Then you could get the clientId, clientSecret,tenantId.