Forum Discussion
Dean_Gross
Apr 24, 2018Silver Contributor
Maintaining Multiple Connections to PnPONline
I'm trying to create a script that will copy users from SPO Groups to Office/Unified groups. I think that I should be able to do this by using Connect-pnpOnline -graph and Connect-PnPOnline -Url, b...
Gautam Sheth
Apr 27, 2018Brass Contributor
I think you need to use the ReturnConnection parameter of the Connect-PnPOnline command.
Sample code would be something like :
$connection1 = Connect-PnPOnline -Url "someurl" -ReturnConnection
$connection2 = Connect-PnPOnline -Graph -ReturnConnection
Get-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com -Connection $connection1
New-PnPUser -LoginName "<loginName>" -Connection $connection2
https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/connect-pnponline?view=sharepoint-ps