-
Hi everyone, using Below is the sample code to connect to two separate tenants. But how i can execute any function on each of the tenant. I added Get-PnPUser function for referrence. `$connection1 = Connect-PnPOnline -Url "https://Tenant1-admin.sharepoint.com" -UseWebLogin -ReturnConnection $userProfile = Get-PnPUser | ? Email -eq "userid@Tenant1.com" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @Adnanamin When you connect with "Connect-PnPOnline" you obtain the context for one particular tenant. All PnP commands you execute will execute against the SharePoint context of that tenant. If you would like to use another context you must first "Disconnect-PnPOnline" and then "Connect-PnPOnline" to the additional tenant. You can then use that context. |
Beta Was this translation helpful? Give feedback.
Hi @Adnanamin When you connect with "Connect-PnPOnline" you obtain the context for one particular tenant. All PnP commands you execute will execute against the SharePoint context of that tenant. If you would like to use another context you must first "Disconnect-PnPOnline" and then "Connect-PnPOnline" to the additional tenant. You can then use that context.