AzureAD / MSAL.PS

MIT License
159 stars 29 forks source link

Enable-MsalTokenCacheOnDisk failing when a latest version of Microsoft.Identity.Client.dll is loaded #33

Closed ggireeshkumar closed 2 years ago

ggireeshkumar commented 3 years ago

Enable-MsalTokenCacheOnDisk failing with error below when a latest version of Microsoft.Identity.Client.dll is loaded

Enable-MsalTokenCacheOnDisk : Cannot convert argument "tokenCache", with value: "Microsoft.Identity.Client.TokenCache", for "EnableSerialization" to type "Microsoft.Identity.Client.ITokenCache": "Cannot convert the "Microsoft.Identity.Client.TokenCache" value of type "Microsoft.Identity.Client.TokenCache" to type "Microsoft.Identity.Client.ITokenCache"."

jazuntee commented 2 years ago

This can happen when the DLLs included with MSAL.PS cannot be loaded due to a conflict with another DLL loaded in the current PowerShell session, often from another module like Azure or Exchange Online Admin Shell. I would suggest ensuring that the MSAL.PS module is loaded into the PowerShell session first before any other modules. There is a fix to this but it would require significant rework of the MSAL.PS module in C# so no guarantee this will be addressed anytime soon, if ever.