powershell
powershell copied to clipboard
[BUG] When reusing pnp connection in Connect-PnPOnline to create a new connection the cmdelet asks for interactive login
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