Teams Service unavailable for CsPhoneNumberAssignment

Super Contributor

Hello Teams Community,


Please I need help on this issue.


Migration was done from Skype for Business On-Prem to Microsoft Teams online yesterday. 
After the migration, some users lost their phones and we tried using the PowerShell command to reassign the phone number back to the users but we got an error


 We were able to set the phone number for the user below with the command “Set-CsUser -Identity  -LineUri “tel:+40000000”.


After a while, the number is now shown in Teams Admin Center and the user is available for external calls.


But with this command “Set-CsPhoneNumberAssignment” is still the same error.



Users are losing their CsPhoneNumberAssignment. While trying to reassign it we get the error shown in Screenshot.

3 Replies
I've seen this error when not specifying the locationId

The LocationId of the location to assign to the specific user. You can get it using Get-CsOnlineLisLocation.

Removal of location from a phone number is supported for Direct Routing numbers and Operator Connect numbers that are not managed by the Service Desk. If you want to remove the location, use the string value null for LocationId.
Besides the -LocationId mentioned by @andres,
- Did you check if the users have Teams telephony licensing assigned?
- can you run the legacy command to enable enterprise voice too?
Set-CsUser -Identity <sipaddressofuser> -LineUri “tel:+40000000” -EnterpriseVoiceEnabled $true
Does users have license assigned?
This is what we're using for Direct Routing.
Set-CsUser -Identity <UPN> -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI "tel:+40000000"
Grant-CsOnlineVoiceRoutingPolicy -Identity $UPN -PolicyName <NAME>
Grant-CsTeamsCallingPolicy -PolicyName <NAME> -Identity $UPN
Grant-CsTenantDialPlan -Identity $UPN -PolicyName <NAME>