简体   繁体   中英

Azure Media Services v3 Not Compatible with Azure Function

I am trying to recreate this walkthrough

https://docs.microsoft.com/en-us/azure/media-services/latest/stream-files-tutorial-with-api#download-the-sample

as an Azure Function, and it seems there is some incompatibility between the Azure Function SDK and Microsoft.IdentityModel.Clients.ActiveDirectory. If you try to create a new ArmClientCredentials like so

ArmClientCredentials credentials = new ArmClientCredentials(config);

You get an error like so

Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.19.4.11002

The particular nuget package is added to the project. Is this something that requires an additional step not shown here?

I had a similar issue using Azure Functions using the blob trigger template. Instead of using the latest version of Microsoft.IdentityModel.Clients.ActiveDirectory (which is 3.19.4 as of writing) I had to downgrade to the version number that media services package is looking for (indicated in the error).

My project.json that worked for Media Services v2:

{
  "frameworks": {
    "net46":{
      "dependencies": {
        "windowsazure.mediaservices": "4.1.0.1",
        "windowsazure.mediaservices.extensions": "4.1.0.1",
        "Microsoft.IdentityModel.Clients.ActiveDirectory": "3.13.1",
        "Microsoft.IdentityModel.Protocol.Extensions": "1.0.2.206221351"
      }
    }
   }
}

Kindly check if the setting below works for you and Media Services v3. At the very least, these should be in your project.json in Azure Function:

{
  "frameworks": {
    "net46":{
      "dependencies": {
        "Microsoft.Azure.Management.Media": "1.0.0",
        "Microsoft.IdentityModel.Clients.ActiveDirectory": "3.19.4",
        "WindowsAzure.Storage": "9.1.1"
      }
    }
   }
}

I was able to solve this problem by rolling down the version of the package to 3.14. here is the repo of the solution (using csproj)

https://github.com/isaac2004/AzureMediaServicesDemo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM