Connect-PnPOnline is throwing Could not load file or assembly 'Microsoft.Identity.Client' #3748
Replies: 3 comments
-
Hi @gautamdsheth, |
Beta Was this translation helpful? Give feedback.
-
Hi @gautamdsheth, Could you please let us know the timelines for the fix of this issue? |
Beta Was this translation helpful? Give feedback.
-
Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
Reporting an Issue or Missing Feature
Issue
Connecting to PnP module using the Connect-PnPOnline command is throwing an unexpected error. We could observe this is an intermittent issue, but now it is occurring too frequently.
Expected behavior
For connecting to PnP module, as mentioned in the documentation we have Imported the PnP module and by using the Connect-PnPOnline, it should connect to Sharepoint tenant
Environment:
Azure Powershell Function
Powershell version: 7.2
PnP module version: 2.3.0
Import-Module "D:\home\site\wwwroot\Modules\pnp.powershell.2.3.0\PnP.PowerShell.psd1";
Connect-PnPOnline -Url $sharepointAdminUrl -ClientId $appId -Tenant $domain -Thumbprint $certificateThumbprint -ErrorAction:Stop
The above should succesfully connect to Sharepoint
Actual behavior
When connecting to PnP, the below error is being popped up frequently
"errorStackTrace": " at PnP.PowerShell.Commands.Base.PnPConnection.CreateWithCert(Uri url, String clientId, String tenant, String tenantAdminUrl, AzureEnvironment azureEnvironment, X509Certificate2 certificate, Boolean certificateFromFile)\r\n at PnP.PowerShell.Commands.Base.ConnectOnline.ConnectAppOnlyWithCertificate() in c:\build\src\Commands
Base
ConnectOnline.cs:line 532\r\n at PnP.PowerShell.Commands.Base.ConnectOnline.Connect(CancellationToken& cancellationToken) in c:\build\src\Commands
Base
ConnectOnline.cs:line 298\r\n at PnP.PowerShell.Commands.Base.ConnectOnline.ProcessRecord() in c:\build\src\Commands
Base
ConnectOnline.cs:line 248\r\n at System.Management.Automation.CommandProcessor.ProcessRecord()",
"CommandError": "Could not load file or assembly 'Microsoft.Identity.Client, Version=4.50.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Could not find or load a specific file. (0x80131621)",
"errorMessage": "Could not load file or assembly 'Microsoft.Identity.Client, Version=4.50.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Could not find or load a specific file. (0x80131621)"
Steps to reproduce behavior
$sharepointAdminUrl = "https:"
$appId = "xxx" // Application registered in the azure portal with all the necessary permisiions mentioned
$certificateThumbprint = "xxx" // thumbprint of the above applicationId
$domain="xxx.com" // domain of our organization
Import-Module "D:\home\site\wwwroot\Modules\pnp.powershell.2.3.0\PnP.PowerShell.psd1"; // dowmloaded and imported in the local of the function app
Connect-PnPOnline -Url $sharepointAdminUrl -ClientId $appId -Tenant $domain -Thumbprint $certificateThumbprint -ErrorAction:Stop
What is the version of the Cmdlet module you are running?
PnP version -2.3.0
Which operating system/environment are you running PnP PowerShell on?
Azure Functions
Beta Was this translation helpful? Give feedback.
All reactions