Forum Discussion

AlistairKeay1's avatar
AlistairKeay1
Brass Contributor
Jul 30, 2023

Connect to two Tenants Single PS Session (connect-MicrosoftTeams)

I am migrating a customer from one tenant to another (Teams Voice)
What I am interested in, is it possible to connect to two tenants in a single PS session
Till now I would export in one session to a file then import to the other and upload. So not very efficient

However I stumbled across an article for exchange where you could connect to two tenants in a single PS session to migrate data... but I can't get it to work in teams
Ref https://mymicrosoftexchange.wordpress.com/2017/10/05/office-365-run-a-script-connected-to-2-exchange-online-sessions/

I have tried the following

$sourceSession = connect-MicrosoftTeams
$result = import-pssession $sourceSession -prefix SRC

$DestSession = connect-MicrosoftTeams
$result = import-pssession $DestSession -prefix DST
 
However I get 
Import-PSSession: Cannot bind parameter 'Session'. Cannot convert the "Microsoft.TeamsCmdlets.Powershell.Connect.Models.PSAzureContext" value of type "Microsoft.TeamsCmdlets.Powershell.Connect.Models.PSAzureContext" to type "System.Management.Automation.Runspaces.PSSession".


I have a nasty feeling while Import-PSSession is supported for exo and was for SFB O I don't think Teams supports this.

Any advice\thoughts welcome.

No RepliesBe the first to reply

Resources