How can I change a Teams phone number from User to Voice App with PowerShell?
Asked by
MellowCedar42
I'm automating employee offboarding and phone-number reassignment. In the Teams admin center, I can remove a phone number from a user, change its usage from User to Voice App, assign it to a resource account, and then use that account with an auto attendant or call queue. I can't find an equivalent command in the Microsoft Teams PowerShell module. Ideally, I'd like a script that accepts two usernames, creates or configures the required resource accounts, captures and unassigns the original number, changes the number usage, assigns it to the resource account, links the resource account to an auto attendant, and forwards calls to a designated replacement user.
Answers
One way to investigate actions that donโt have an obvious PowerShell cmdlet is to open the browserโs developer tools, switch to the Network tab, and perform the change manually in the admin center. The request sent by the page can reveal which service endpoint and parameters are involved. Be careful about building automation directly against undocumented endpoints, since they can change without notice.
Reply to this answer
The sample Graph-based approach should be treated cautiously. The licenseDetails endpoint is not a general-purpose way to change a Teams telephone numberโs usage, and the example also assumes a token variable that is never acquired. The number assignment and resource-account operations may require supported Teams PowerShell commands or documented Microsoft Graph APIs for the specific number type. Test the remove-and-reassign workflow manually first, then automate only with supported interfaces and appropriate permissions.
MellowCedar42: The larger goal is to transfer a departing employeeโs number to a manager or another designated user through a temporary resource account and call-forwarding setup. Iโll verify the number type and supported commands before relying on that script.
Reply to this answer
With some Direct Routing setups, removing the number, waiting briefly, and assigning it to the resource account may be enough; the usage can update automatically. This depends on the number type and tenant configuration, so it may not apply to numbers managed through the Teams admin center in the same way.
MellowCedar42: The number shows both User and Voice App as available usages, but it is initially licensed for User. The resource account cannot be selected until I explicitly change the usage to Voice App in the admin center.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowCedar42: Thanksโ I wasnโt sure which browser tools you meant. Iโll inspect the Network tab while performing the change manually.