powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Get stuck on connecting with Connect-PnPOnline ... -Interactive

Open saendu opened this issue 5 years ago • 7 comments

Reporting an Issue or Missing Feature

When trying to login to a SharePoint site with Connect-PnPOnline ... -Interactive the login popup window freezes after entering the 2FA code.

I tried with: SharePoint Online Powershell: PSVersion 5.1.17763.1852 PSVersion 5.1.17763.1852 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.1852 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

And with Latest Powershell 7.1.3 Name Value


PSVersion 7.1.3 PSEdition Core GitCommitId 7.1.3 OS Microsoft Windows 10.0.17763 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Expected behavior

Popup disappears and I have a successful connection in powershell.

Actual behavior

Login screen freezes after entering 2FA code or after selecting already logged in user.

Steps to reproduce behavior

Use Connect-PnPOnline ... -Interactive with 2FA enabled.

What is the version of the Cmdlet module you are running?

PnP.PowerShell 1.5.0

Which operating system/environment are you running PnP PowerShell on?

  • [x] Windows Server 2019
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

saendu avatar May 06 '21 12:05 saendu

@saendu , have you tried updating a module? 1.5.0 seems out of date

YuriySamorodov avatar May 08 '21 10:05 YuriySamorodov

Same behaviour with most recent nightly build.

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   1.5.39     nightly    PnP.PowerShell                      Core,Desk {Add-PnPClientSidePage, Add-PnPClientSi…

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   1.5.0                 PnP.PowerShell                      Core,Desk {Add-PnPClientSidePage, Add-PnPClientSi…

saendu avatar May 11 '21 17:05 saendu

@saendu - Are you trying to connect to SharePoint Online from Windows Server 2019?

veronicageek avatar May 11 '21 17:05 veronicageek

Yes, as mentioned above.

saendu avatar May 11 '21 17:05 saendu

I don't have a WinSer2019 environment, and it will also be difficult to know the config of your server. With the number of times that this cmdlet is ran per day and no reports, we're pretty certain it's working. Unfortunately, we can only suggest you try on a different environment so you can pinpoint your issue possibly on the server.

veronicageek avatar May 24 '21 18:05 veronicageek

@saendu , curious... Do you have Internet Explorer Enhanced Security Configuration enabled? I am seeing something similar, and it appears to be linked to the Advanced setting that is enabled with ESC of "Warn if POST submittal is redirected to a zone that does not permit posts"... It looks like the Warn if change between secure vs not secure mode setting is in play too. Inspecting my traffic indicates that a post to login.microsoftonline.com.... results in a 302 redirect for a moved file to localhost, which seems to be where the security controls are kicking in.

hotsauce-v2 avatar May 28 '21 16:05 hotsauce-v2

@hotsauce-v2 I was already checking internet explorer security settings but was ignoring the enhanced security configuration. It indeed was the issue of not going on with the POST correctly.

Disabling Enhanced Security Configuration did the job!

Thanks, closing.

saendu avatar Jun 02 '21 18:06 saendu