Error when moving user from Skype4B onprem to online

In a freshly set up Skype for Business hybrid environment we got this error after trying to move the first user from onprem to online:

HostedMigration 510 error : the user could not be moved because the tenant has not been enabled for shared SIP address spaces

After verifying that both the tenant and onprem environment is actually set up for shared address spaces with

Get-CsTenantFederationConfiguration

and

Get-CsHostingProvider

the issue is still there.

I did find a blogpost and an ms forum post on this, but in both those cases the problem seemed to be some caching of some sort and solved itself, which it didn’t in my scenario.

It turned out that the user were homed in a child domain and the FE pool in the root domain. The problem was solved by running the Move-CsUser Cmdlet with the -DomainController parameter as well, like this:

Move-CsUser -Identity user@contoso.com -Target sipfed.online.lync.com -Credential $cred -HostedMigrationOverrideUrl "https://adminXX.online.lync.com/HostedMigration/hostedmigrationService.svc" -DomainController dc.contoso.com

Remember that your HostedMigrationOverrideUrl will probably be different, just log in to the SFBO admin portal to get yours.´´´