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

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

  1. Thanks a lot guys! I was searching for hours and then found your blog post, solved the issue, thank you!

Leave a Reply to Florian Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.