Adding a Number to a Teams User

Number to a Teams User

So your organization has decided to do away with their phone system an go directly to Microsoft Teams Voice. Now all that is left to do is Adding a Number to a Teams User. The only prerequisite is that you have a block of DID assigned to you by your Telco.

If you don’t have many users to add telephone numbers to, you can manually enter them using some PowerShell commands. However, if you have a lot to do I can show you a way to automate them. Let’s add some numbers!!

You Only Have a Few Users To Do

This is also a good way for adding the odd number after the migration.

Connecting to the Teams Module


Add User Number

Set-CsPhoneNumberAssignment -Identity [email protected] -PhoneNumber ‘+1XXXXXXX’ -PhoneNumberType DirectRouting

Grant-CsOnlineVoiceRoutingPolicy -Identity [email protected] -PolicyName “Policy set up by you or Telco”

Set-CsOnlineVoiceMailUserSettings -Identity [email protected] -VoicemailEnabled $true

If you make a mistake you can easily remove the number and start again:

Remove User Number

Grant-CsOnlineVoiceRoutingPolicy -Identity [email protected] -PolicyName $null

Remove-CsPhoneNumberAssignment -Identity [email protected] -RemoveAll

But what if you have a lot of users to to???

You Have a Many Users To Do

You can run these commands in a batch but I would recommend testing it with a small block of users before you go ahead with the whole group. You could run a batch delete and start from scratch but that sounds like a headache….

You can use a for each loop going through each user in an import CSV you created. Create a CSV file with two field names: UPName and PNumber. Populate it with your users and then create this PowerShelScript:

$CSVPath = “<Path To File Goes Here>”



#Try import CSV file

try {
$Users = import-csv $CSVPath -ErrorAction stop
catch {
throw “Error importing CSV: $($_.Exception.Message)”

#Add Numbers

foreach ($User in $Users) {

Set-CsPhoneNumberAssignment -Identity $User.UPName -PhoneNumber $User.PNmuber -PhoneNumberType DirectRouting

Grant-CsOnlineVoiceRoutingPolicy -Identity $User.UPName -PolicyName “PolicyNameGoesHere”
Set-CsOnlineVoiceMailUserSettings -Identity $User.UPName -VoicemailEnabled $true


Write-Host User Numbers Added!

This should help you get your phone numbers added quickly.

Happy IT’ing


Quick IT TIps!

Don’t miss these tips!

We don’t spam! Read our privacy policy for more info.

Avatar photo

I am an IT professional with over twenty years experience in the field. I have supported thousands of users over the years. The organizations I have worked for range in size from one person to hundreds of people. I have performed support from Help Desk, Network / Cloud Administration, Network Support, Application Support, Implementation and Security.

Leave a Comment

Pin It on Pinterest