Assigning online service number to an resource account - Powershell fail

Vlatko Jordanov 96 Reputation points

Hello Guys,

I am getting really frustrated now as I cannot figure out what is wrong with the following that I will try to describe as best as possible. I am in process of commissioning resource accounts which went pretty well via MSOL powershell. The next step what I had to do is to buy Toll numbers to create call queues, which is fine I managed to purchase 30 numbers. In order to assign the number following MS best practices is to go into Org-wide settings -> Resource accounts -> select the account -> press Assign/unassign -> select Online from the "Phone number type" in the dropdown menu -> type in the desired number which I previously purchased and it couldn't be found.

That's ok I knew this from before but I hoped MS fixed this by now hence giving it a chance. That said and done I turned to powershell and fired up the usual script I am using when I have to do stuff the better way rather than messing with GUI:

Import-Module LyncOnlineConnector
Import-Module SkypeOnlineConnector
Import-module ActiveDirectory
Import-Module MSOnline
Import-Module MicrosoftTeams
Import-Module SkypeOnlineConnector

$CloudCred = Get-Credential ""
$session = New-CsOnlineSession -Credential $CloudCred -OverrideAdminDomain "" -Verbose
Import-PSSession $Session -Allowclobber -verbose

Connect-azuread -accountid


Connect-MicrosoftTeams -accountid

Which connected me to all the necessary and unnecessary endpoints of MS but that's just my personal preference when working.

That said I wrote this basic foreach block to cycle the numbers for each users pulled from a CSV which contains items: UserPrincipalName,DisplayName,PhoneNumber,ObjectID

$import = Import-Csv -Path C:\PurchasedOnlineNumbers.csv
foreach ($user in $import) {
Set-CsOnlineVoiceApplicationInstance -Identity $user.ObjectID -TelephoneNumber $user.PhoneNumber}

And that threw an error after an error:
The input of parameter "‪+441234567890‬" is not in a valid format. Please provide an input with an acceptable format <tel:>+[number]", e.g. +18005551234 or +14251234567.

  • CategoryInfo : NotSpecified: (:) [Set-CsOnlineVoiceApplicationInstance], BvdCmdletException
  • FullyQualifiedErrorId : TelephoneNumberInvalidFormat,Microsoft.Rtc.Management.Hosted.Bvd.SetVoiceAppEndpointCmdlet
  • PSComputerName :

Until the cycle finally finished and of course failed. To rule out that the commandlet is not able to read the CSV properly I did a single shot with a single user and a telephone number but got the same results!

What is weird enough earlier today I purchased a test Toll service number which is the same format as the bulk of 30 I bought earlier is assignable running the same command!!!

The real question is, am I missing something out with the script or it's just my MS Tennant needing more time to realise that these numbers are actually owned by it????

Any input would be appreciated guys, I am kinda busted and really need help fast with this one!


Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
7,576 questions
Microsoft Graph Teamwork API
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,355 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,083 questions
{count} votes

Accepted answer
  1. Vlatko Jordanov 96 Reputation points

    So this was basically a MS backend issue, powershell remained broken for some time but GUI started working - wonder how?

    Title: Admins can't assign phone numbers in the Microsoft Teams admin center to resource accounts

    User Impact: Admins may be unable to assign phone numbers in the Microsoft Teams admin center to resource accounts.

    Current status: We're continuing with our development of a fix for this issue. Additionally, we're gathering diagnostic data to help us understand the root cause of the issue.

    Scope of impact: Your organization is affected by this event, and any admin attempting to assign a phone number to a resource account may be impacted.

    Next update by: Friday, December 18, 2020, 6:00 PM (5:00 PM UTC)

    Anyway as said it was fixed and I am glad I got the job done in timely manner. Happy that It wasn't me doing something wrong :D

    Cheers everyone and thanks for the support!


1 additional answer

Sort by: Most helpful
  1. Sharon Zhao-MSFT 24,951 Reputation points Microsoft Vendor

    @Vlatko Jordanov ,

    Do you check if the test toll service number can be found in Org-wide settings -> Resource accounts -> select the account -> press Assign/unassign -> select Online from the "Phone number type" in the dropdown menu?

    If it can be searched, the cause maybe the synchronization or the service number itself.

    It recommends you confirm with Microsoft if these phone numbers are normal.

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.