Hello,
We're trying to use the library Microsoft.IdentityModel.Clients.ActiveDirectory; for acquiring authorization tokens from Azure AD in order to use with the new PowerBI API. This code works fine locally but we receive an error when trying to run it in crm online (from a plugin action).
I'm guessing this is because the plugins are sandboxed and that this library is using IO-stuff. So my question is: is there any way around this? or is there any other implementations of ADAL-authentication that might work in crm online?
The error message:
System.TypeInitializationException: The type initializer for 'Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Reflection.RuntimeAssembly.VerifyCodeBaseDiscovery(String codeBase) at System.Reflection.RuntimeAssembly.GetName(Boolean copiedName) at Microsoft.IdentityModel.Clients.ActiveDirectory.AdalIdHelper.GetAdalVersion() at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext..cctor() --- End of inner exception stack trace --- at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext..ctor(String authority) at BusinessLogic.AccountBusinessLogic.GetToken() at Plugins.Actions.MessageBoard.GetTokenTest.Execute(IOrganizationService service) at Plugins.Common.ActionRequestHandler.ExecuteAction(String requestType, String inputData)