Erwin Bierens

Knowledge is Power

Set-CsPhoneNumberAssignment : An unknown error occurred

2023-08-21 1 min read Microsoft Teams

Today I ran into an issue where it was not possible to associate a phone number with a user in Microsoft Teams using PowerShell. Even the Teams Admin Center displayed an unknown error.


Microsoft.Teams.ConfigAPI.Cmdlets.internal\Set-CsPhoneNumberAssignment : An unknown error occurred
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\5.5.0\custom\Merged_custom_PsExt.ps1:1339 char:13
+             $result = Microsoft.Teams.ConfigAPI.Cmdlets.internal\Set- ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ Identity = te...iceEnabled =  }:<>f__AnonymousType107`7) [Set-CsPho
neNumberAssignment_Set], Exception
    + FullyQualifiedErrorId : BadRequest,Microsoft.Teams.ConfigAPI.Cmdlets.Generated.Cmdlets.SetCsPhoneNumberAssignment_Set

After some investigation, I found out that the user’s usage location was not configured to the correct country. The user was on located to Portugal, the phone number we wanted to associate is +31, which corresponds to the Netherlands.

A few minutes after adjusting the usage location it was possible to link the phone number using PowerShell.

Hopefully this small article will save you time in the future ;-)

comments powered by Disqus