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.
3 Answers
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.
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.
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.
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.
Thanks— I wasn’t sure which browser tools you meant. I’ll inspect the Network tab while performing the change manually.

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.