Summary: Trying to create a AzureAdTokenCredentials object results in FileNotFoundException trying to load Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.13.1.846. I have Version=3.19.4 installed.
Details: I told myself I'd never be the guy who asks such a basic question but here we go. So I recently authored an Azure Function that will interact with Media Services. Step one was create the CloudMediaContext. Seems straight forward. I wrote the following code:
private CloudMediaContext CreateCloudMediaContext()
{
var key = new AzureAdClientSymmetricKey(_amsClientId, _amsClientSecret);
var credentials = new AzureAdTokenCredentials(_amsAadTenantDomain, key, AzureEnvironments.AzureCloudEnvironment);
var provider = new AzureAdTokenProvider(credentials);
return new CloudMediaContext(new Uri(_amsRestApiEndpoint), provider);
}
This promptly exploded when trying to create a new AzureAdTokenCredentials object with the dreaded FileNotFoundException which specified a pretty old version of the ActiveDirectory assembly that I'm already using for various other functionality in my app.
My question ultimately is, do I really need to install a version of the the assembly from nearly 2 years ago SxS with the latest version to fix this or is there a better solution?
If you look at other example Functions that are using the Azure Media Services APIs up here, https://github.com/Azure-Samples/media-services-dotnet-functions-integration/tree/master/media-functions-for-logic-app you will see a similar pattern. The version of the .NET SDK for Media Services is a bit old now... but the good news is we are going to be releasing preview of v3 of the Media Services API and a new SDK next week at the //BUILD conference.
The new SDK will only have the following two dependencies:
If you are willing to try out and move to the newer API, you can wait until early next week.
What scenario are you working on exactly? Encoding, Streaming, or Live?