Apr 24 2018 08:44 AM
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, but I'm not sure how to maintain 2 separate connections in the same script. Can someone point in the right direction?
Apr 27 2018 05:54 AM
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
Connect-PnPOnline