Product: PowerShell Universal
Version: 2.1.2
I want to create an API which works as a Sharepoint File Upload Gateway. The following code works fine directly executed from PWSH 7:
import-module pnp.powershell
$cred=get-secret "MyM365-Credential"
$SharepointURL = "https://company.sharepoint.com/sites/Site123"
$OutPath = "C:\temp\demo.txt"
Connect-PnPOnline $SharepointURL -Credentials $cred
Add-PnPFile -Folder "Shared%20Documents/" -Path $OutPath
If I run it from an API endpoint it has problems with the JWT assembly version:
Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=6.11.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621)
So I tried to offload the code into a PSU script, same code, dedicated environment which points to the pwsh.exe. Now it has problems with another assembly:
Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
Any hint how to handle such problems or how to track down the culprit?
-Sascha aka callidus2000