Adding a phone number to a teams resource account in PowerShell

Recently I was setting up a new phone number queue in Microsoft Teams. As part of this, I was trying to set up a new phone number for the queue. The problem was that every time I tried the Microsoft Teams admin page said that I didn’t have any available phone numbers even though I knew for a fact that I had a phone number current available and set up as a service phone number.

The solution to this was to use the PowerShell cmdlet Set-CsOnlineVoiceApplicationInstance to update the Resource Account with the correct phone number. The problem was that everything online said to connect to SkypeOnline with PowerShell, but nothing every said what needed to get that done. (Yes, this cmdlet is from Skype for Business not Teams, even though this is being done through Teams.)

I was eventually able to piece together what needed to be done.

Skype For Business cmdlet modules aren’t available through install-module. They need to be downloaded and installed from the Microsoft Website.

After the installer is run, open a new PowerShell window in Admin mode.

From there use PowerShell to authenticate and connect to SkypeOnline.

If you don’t have MFA configured use the following PowerShell code.

Import-Module SkypeOnlineConnector
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $UserCredential
Import-PSSession $sfbSession

If you have MFA configured then use the following PowerShell code.

Import-Module SkypeOnlineConnector
$sfbSession = New-CsOnlineSession
Import-PSSession $sfbSession

Once you’ve complete that use the following code to assign the phone number to the Resource Account.

Set-CsOnlineVoiceApplicationInstance -Identity ""  -TelephoneNumber "+18585551212"

Now keep in mind that I’m using a US Phone number here, hence the +1. If you are in another country your country code will be different. Whatever the phone number that you have available as a service phone number is the phone number that you enter here.

Once this cmdlet was done the phone number listed was allocated to the resource account, and the phone number was setup and ready to go.



One Response

  1. Yep – I worked so hard to figure this out as well. I just figured out what you posted and then found your article. Glad you have posted this as I know we aren’t the only ones struggling with this.

    The Microsoft documentation talks in circles!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trust DCAC with your data

Your data systems may be treading water today, but are they prepared for the next phase of your business growth?