I am trying to use Azure Media Services to encode videos uploaded to my web app. Now that ACS is removed from AMS .net extensions and api, it seems the only way to connect is using Azure AD credentials. So I have registered service principal with AAD and Granted contributor right on AMS.
All the permissions seems correct and I try to run this sample code and Azure refuses to issue token.
Fails on line 80:
IAsset sourceAsset = _sourceContext.Assets.Where(a => a.Id == _sourceAssetID).First();
Same case with any other operation against AMS.
"ExceptionMessage": "Error HRESULT E_FAIL has been returned from a call to a COM component.",
"ExceptionType": "System.Runtime.InteropServices.COMException",
"StackTrace": " at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.WebUI.<AcquireAuthorizationAsync>d__12.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenInteractiveHandler.<AcquireAuthorizationAsync>d__10.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenInteractiveHandler.<PreTokenRequest>d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase.<RunAsync>d__57.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.<AcquireTokenCommonAsync>d__39.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.<AcquireTokenAsync>d__28.MoveNext()"
This error message is from AD.
Wondering if there is anything I need to do on Azure Api app to make this work?