Cannot Move SfB OnPrem user to Teams – OAuth_Bearer did not return expected status code from request


We notice an error while trying to move a user from the Skype for Business 2019 OnPrem to Teams:

Trying to move on-prem skype for business user to Teams and getting an error Noticed the issue today when i tried to move a user The error i see is Move-CsUser : Hosted Migration Service (https://admin1a.online.lync.com/HostedMigration/HostedMigrationService.svc/OAuth_Bearer) did not return expected status code from request for WWW-Authenticate header. At line:1 char:1 + Move-CsUser -Identity user@contoso.com -Target sipfed.online.lync.com + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (CN=USER...DC=contoso,DC=com:OCSADUser) [Move-CsUser], MoveUserException + FullyQualifiedErrorId : MoveError,Microsoft.Rtc.Management.AD.Cmdlets.MoveOcsUserCmdlet

This might be related to TLS 1.0/1.1 deprecation in Office 365.

To force TLS 1.2 and be able to move the users, run this in PowerShell before running the Move-Cs User cmdlet:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

And here is an example to move the users:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$cred=Get-Credential
$url="https://admin2a.online.lync.com/HostedMigration/hostedmigrationService.svc"
Move-CsUser -Identity username@contoso.com -Target sipfed.online.lync.com -Credential $cred -HostedMigrationOverrideUrl $url

For more details please check:

Move users from Skype for Business Server 2019 to Teams – Skype for Business Hybrid | Microsoft Docs

Please note that moving users from Online to SfB OnPrem the error will be different, here is an example:

Move-CsUser : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
+ Move-CsUser -Identity user@contoso.com -Target sfbpool.contoso.com ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (CN=USER,DC=contoso,DC=com:OCSADUser) [Move-CsUser], WebException
+ FullyQualifiedErrorId : MoveError,Microsoft.Rtc.Management.AD.Cmdlets.MoveOcsUserCmdlet