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.


Contact the Author | Contact DCAC

In Azure CApS MatTers

Recently I was doing some work for a client moving some vDisks from standard storage to premium storage. Overall it was a pretty easy migration to do, just requiring a little PowerShell to make it all happen.

The part that made it hard to get done is that the PowerShell parameters for file names on blob storage are case sensitive. This is a pain when the person who setup the virtual drives (not me) isn’t consistent in how they setup the file names. In this case the three drives which I needed to move where named like this.

  • sql1.vhd
  • SQL2.vhd
  • Sql3.vhd

This means that it takes some work and some careful looking to ensure that you have the case of each file correct so that the scripts actually work as planned. I got through it, but not without a decent of grumbling at my computer.

So when setting up drives for VMs in Azure, keep everything consistent. You’ll thank me later.


Contact the Author | Contact DCAC


Globally Recognized Expertise

As Microsoft MVP’s and Partners as well as VMware experts, we are summoned by companies all over the world to fine-tune and problem-solve the most difficult architecture, infrastructure and network challenges.

And sometimes we’re asked to share what we did, at events like Microsoft’s PASS Summit 2015.

Awards & Certifications

Microsoft Partner   Denny Cherry & Associates Consulting LLC BBB Business Review    Microsoft MVP    Microsoft Certified Master VMWare vExpert
INC 5000 Award for 2020    American Business Awards People's Choice    American Business Awards Gold Award    American Business Awards Silver Award    FT Americas’ Fastest Growing Companies 2020   
Best Full-Service Cloud Technology Consulting Company       Insights Sccess Award    Technology Headlines Award    Golden Bridge Gold Award    CIO Review Top 20 Azure Solutions Providers