In this article I describe the functionality of my Powershell script tool for managing Microsoft Teams Voice.

I have developed a PowerShell tool that should simplify the daily and non-daily work with Teams Voice.


This tool has three categories, which are divided into the administration of phone numbers for users, the creation of callflows and resource accounts including licence assignment and the administration of existing phone numbers.


The script can be executed without initial configuration.



Using the script

When the script is executed, we are already confronted with the first question. This is about whether we want to establish a connection with PowerShell to our Teams Tenant. If this connection already exists and we do not want to establish an additional connection, we can continue here with NO.


If this script is being executed for the first time or if there is not yet a connection to Microsoft Teams, YES can be selected here.



If we have selected YES here, the script checks whether a PowerShell module is already available, if this is not the case, the corresponding module will be installed.

If the Microsoft Teams PowerShell module already exists, the script checks whether it is on the latest version.


NOTE: Therefore it is important that this script is executed as admin.


After successfully connecting to Microsoft Teams via PowerShell, we get a menu with three options.



The login to Microsoft Teams also supports the Microsoft MFA authentication.



Option 1 – Assign phone numbers to users

In the first selection, we would like to use a CSV file to assign telephone numbers to our users.

The information that this CSV must contain is explicitly shown again in this step.

A window opens where we can search for the corresponding CSV file and then select it.
After successfully importing the CSV data, it is displayed in the script.

After checking the data, we now have the option to choose whether to continue or to import a different file.

If we have imported the correct data, the telephone number for each user is now set as it was stored in the CSV.


After this process has been carried out, we get an overview of the current users and their numbers.



Option 2 – Creating resource accounts including call queues

For this option I have decided to record a short video to show how it works.

With this option, a resource account (auto attendant and call queue) and a call queue are created.

Furthermore, the required Teams Voice virtual user licence is also assigned accordingly (if available).

In the script we can also define the opening hours.

As my location is in Switzerland, I have defined the time zone West Europe as standard in this script.


All links between call queues, auto attendants, etc. are automatically created in this script.

Nevertheless, I strongly recommend to use this script in a test environment at the beginning and to check if the result meets your requirements.


This script module must be run once per call flow.


Here is the corresponding recording from my LAB. (The number I use in the script is a dummy number and not available in the PSTN network).



Option 3 – Telephone number management

Another point is the administration of our existing telephone numbers in the tenant, these can be viewed with this option in the script.

It is important to note that this option is read only and does not allow any changes to the existing numbers.

When selecting the first option, we can display the existing numbers in the tenant.
On the one hand, this works with the view in the PowerShell console.
Or also as a grid view
However, we can also read out the currently assigned numbers. This is also possible with two options, on the one hand as PowerShell console output.
Or also as Grit view



As always, this script is available for free to anyone who needs it. You can download it from my GitHub repository and use it.


Also as always, I assume no responsibility for possible misconfigurations and strongly recommend to use the first run of this script in a LAB or test environment.


This script can be used and adapted indefinitely, but not sold to third parties.


Link to the Script on GitHub