powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] When reusing pnp connection in Connect-PnPOnline to create a new connection the cmdelet asks for interactive login

Open eduardpaul opened this issue 5 months ago • 0 comments

Hi all! I'm trying to reuse a root connection and then create other connections based on that initial connection.

# this connection is successful 

$rootconnection = Connect-PnPOnline -Url $env:Auth_SharePointHost -Tenant $env:Auth_TenantName -ClientId $env:Auth_ClientId -CertificatePath $env:Auth_ClientCertificatePath -ValidateConnection -ReturnConnection

# BUG: this line will ask interactive login and launch browser.

$appconnection = Connect-PnPOnline -Connection $rootconnection -Url "https://tenant.sharepoint.com/sites/test  -ReturnConnection

From pnp documentation, this scenario should be supported with -Connection $rootconnection parameter.

Expected behavior

The root connection must be reused to create the new one.

Actual behavior

New connection will ask interactive login and launch the browser.

Steps to reproduce behavior

Try the provided example. Not sure if it's related only to Linux -wsl- or also to windows.

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

3.1.0

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

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

eduardpaul avatar Jul 15 '25 11:07 eduardpaul