Shantha Kumar T
How to resolve “Could not create SSL/TLS secure channel” exception for SharePoint Online when using PnP PowerShell
When I tried to connect SharePoint Online through PnP PowerShell by using below command.
PS: > $cred = Get-Credential
PS: > Connect-PnPOnline –Url https://<tenant>.sharpeoint.com –Credential $cred
I have received the below error message.
Connect-PnPOnline : The request was aborted: cluld not create SLL/TLS secure channel.
I have checked the code. Oh… and I was entered the url with typo error to connect the site.
So, I have corrected the url and tried to connect the site. It works fine.
PS: > $cred = Get-Credential
PS: > Connect-PnPOnline –Url https://<tenant>.sharepoint.com –Credential $cred
Root cause:
This issue will raise, when we provide the wrong URL.
Solution:
Please check the URL once again, before running the code.
I resolved this issue by using -UseWebLogin instead of passing credentials.
Great. Thanks for sharing the information :)
In my scenario, the SP environment was requiring TLS 1.2 . PowerShell defaults to TLS 1.0 . I ran the following to make PowerShell run TLS 1.2 and fix my issue.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12