Hi there.
I try to use Connect-PnPOnline to connect to my onprem SharePoint farm and it fails with "An error occurred while sending the request". And I have no idea, what to do.
Details:
I have a SharePoint 2019 farm installed on premise.
On another server (appsrv) installed (xtracted and copied) the pnp.powershell module.
In a powershell window on the appsrv I run this code:
$mycred = Get-Credential MYACCOUNT
Connect-PnPOnline -Url https://my-system.mydom.lcl -Credentials $mycred -Verbose -Debug
The result was the error message
"Connect-PnPOnline : An error occurred while sending the request."
Unfortunately I found no results in the web for this error of this function.
Some search results for the message suggested encryption issues
So I checked TLS:
[Net.ServicePointManager]::SecurityProtocol
and
[System.Net.ServicePointManager]::SecurityProtocol
delivered
Tls, Tls11, Tls12
and
get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto'
get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft.NetFramework\v2.0.50727\' -Name 'SchUseStrongCrypto'
gave "1" as result
Looks good
The URL is accessible via
ping my-system.mydom.lcl
and the SharePoint site pops up when entering the url under the same account.
In the event log there only is this:
Error Message = An error occurred while sending the request.
Fully Qualified Error ID = System.Net.Http.HttpRequestException,PnP.PowerShell.Commands.Base.ConnectOnline
Since the error message doesnt help at all, I tried to debug, but the source code at
https://github.com/pnp/powershell/blob/0120ed972265a949a17b40f8ed3d3dd99efacc61/src/Commands/Base/ConnectOnline.cs
or
https://github.com/pnp/powershell/blob/5580ffd3c29fa97e6fcde0aabe3c05c62072785a/src/Commands/Base/PnPConnection.cs
didnt help.
Trying the same on the SharePoint server itself (with installed powershell module) gave the same
A speciality of the test environmet is no connection to the internet, but that shouldn't matter for use on premise ...
Has anyone a clue, what I'm doing wrong or any hints, where I should have a look at?
thanks in advance
okeo