2

I have installed SharePointPnPPowershell on my dev machine which is running SP 2016.

I tried to connected to my local sharepoint site using:

Connect-PnPOnline -Url $url -Credentials $cred

But I am getting the following error:

Connect-PnPOnline : Unsupported User Type 'Unknown'. Please see https://aka.ms/msal-net-up. 
In Zeile:1 Zeichen:1
+ Connect-PnPOnline $url
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-PnPOnline], MsalClientException
    + FullyQualifiedErrorId : Microsoft.Identity.Client.MsalClientException,PnP.PowerShell.Commands.Base.ConnectOnline

$cred is OK (UserName myUserName)

This script worked some weeks ago. We use SSO.

Any Idea?

I tried the solution below: I don't get an error, but the return value is $null:

$snPnPConn = Connect-PnPOnline -Url $url -TransformationOnPrem -CurrentCredential
$snPnPConn -eq $null
True

But get $null as return value

3 Answers 3

1

Use below script to connects to on-premises SharePoint 2013, 2016 or 2019 site with the current user's on-premises Windows credential (e.g. domain\user).

  • Some of PnP command will not work in on premises.
Connect-PnPOnline -Url "https://portal.contoso.com" -TransformationOnPrem -CurrentCredential

Refer the this docs for more details

6
  • I tried the solution below: I don't get an error, but the return value is $null: $snPnPConn = Connect-PnPOnline -Url $url -TransformationOnPrem -CurrentCredential $snPnPConn -eq $null True But get $null as return value Mar 8, 2022 at 9:58
  • It should work as per documentation. Mar 8, 2022 at 10:16
  • After connecting directly call , cmdlet i.e. Get-PnPWeb. Mar 8, 2022 at 10:52
  • Please use Connect-PnPOnline instead of $snPnPConn =Connect-PnPOnline. I doubt if Connect-PnPOnline will return any thing. Mar 8, 2022 at 10:55
  • Why and when changed it. It was a working script. Now I have the additional switch ReturnConnection, but the commands doesn't work. O.K. I don't can edit this comment. How can I answer? After Return it will be send. Mar 8, 2022 at 14:30
0

For PS 5 use modules SharePointPnPPowerShell2013, SharePointPnPPowerShell2016

then you can connect :

Connect-PnPOnline -Url $url -Credentials $cred

Form PS 7 use module PnP.PowerShell:

Connect-PnPOnline -Url "https://portal.contoso.com" -TransformationOnPrem -CurrentCredential
0

I encountered the same issue with my SP 2019. I tried the following:

  1. Install-Module -Name "PnP.PowerShell"
  2. Install-Module -Name SharePointPnPPowerShell2019
  3. closed powershell command window and opened a new one
  4. ran: Connect-PnPOnline -Url "http://[siteUrl]" -Credential (Get-Credential)

Got error: Connect-PnPOnline : Unsupported User Type 'Unknown'. Please see https://aka.ms/msal-net-up.

  1. ran the following: Import-Module SharePointPnPPowerShell2019

  2. exectuted this again: Connect-PnPOnline -Url "http://[siteUrl]" -Credential (Get-Credential)

and then everything worked just fine:

Url                                   CompatibilityLevel
---                                   ------------------
http://wsam                            15

I hope this helps someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.