If you find yourself needing to change a Microsoft Teams Call Queue or Auto Attendant phone number from a Direct Routing to a Microsoft Phone System phone number you need to first remove the Direct Routing number before you can assign the new cloud based Phone System phone number.
Cmdlet invocation error
You might think that since you are applying the new phone number to the same applicationInstance which represents the Teams resource account that is assigned to the Call Queue or Auto Attendant you can just go ahead and assign the new number and it will overwrite the previous one. Guess again!
PS C:\WINDOWS\system32> Set-CsOnlineVoiceApplicationInstance [email protected] -TelephoneNumber +12895551212
WARNING: Correlation id for the request is bc9f0767-2c29-426a-a1ea-24ce3bce3bfb
Cmdlet invocation error
+ CategoryInfo : NotSpecified: (:) [Set-CsOnlineVoiceApplicationInstance], CmdletInvocationException
+ FullyQualifiedErrorId : Error processing cmdlet request,Microsoft.Rtc.Management.Hosted.Bvd.SetVoiceAppEndpointCmdlet
+ PSComputerName : adminca1.online.lync.com
After some head scratching on this, I ran the following cmdlet to clear the existing phone number.
Set-CsOnlineApplicationInstance [email protected] -OnpremPhoneNumber $Null
After waiting a few mins and re-trying the previous cmdlet, the new number is assigned!
Pro Tip
If you noticed that first cmdlet I used initially to set the Phone System number was different than the one I used to remove the existing number then bonus points for you!
You see to assign a Direct Routing number you need to use the Set-CsOnlineApplicationInstance cmdlet along with the -OnpremPhoneNumber parameter which specifies the Direct Routing telephone number.
When working with Microsoft Phone System Service Numbers, you must use the Set-CsOnlineVoiceApplicationInstance cmdlet and the -TelephoneNumber parameter.
Yes, I realize this is confusing which is why Iām writing this to help everyone avoid this situation! I hope it helps at least one person. š
https://docs.microsoft.com/en-us/microsoftteams/manage-resource-accounts