Base Requirements

Make sure you've got the Skype for Business Online PowerShell module installed from Microsoft here.
Connect to Skype for Business Online PowerShell with:

Import-Module SkypeOnlineConnector
$sfbSession = New-CsOnlineSession -OverrideAdminDomain <>
Import-PSSession $sfbSession -AllowClobber

Add a Phone Number to a Resource Account

Ensure you have created a Resource Account either via the Teams Admin Center or using the below PowerShell cmdlet.

A Resource Account can be either an Auto Attendant or a Call Queue, you need to specify which when creating it with the relevant ApplicationId:

  • Auto Attendant: ce933385-9390-45d1-9512-c8d228074e07

  • Call Queue: 11cd3e2e-fccb-42ad-ad00-878b93575e07

New-CsOnlineApplicationInstance -UserPrincipalName <UPN> -ApplicationId <Auto Attendant/Call Queue ID> -DisplayName "<A meaningful name>"

Then assign a free Phone System Virtual User license to the new resource account in the Microsoft 365 Admin Center.

Finally, enable calling and attach a phone number to the resource account with this cmdlet:

Set-CsOnlineApplicationInstance -Identity <UPN> -OnpremPhoneNumber "+64<phone number>"

Remove a Phone Number from Resource Account

Set-CsOnlineApplicationInstance -Identity <Resource Account UPN> -OnPremPhoneNumber ""

Deleting a Resource Account

Remove the phone number first or you can end up stuck with a half-provisioned Resource Account.

Once you have removed the phone number, simply delete the Resource Account in the Microsoft 365 Admin Center.

Assign a Phone Number to a User

Set-CsUser -Identity -OnPremLineURI TEL:+6491234567

Remove a Phone Number from a User

Set-CsUser -Identity -OnPremLineURI $null

Get the current Phone Number assigned to a user

Get-CsOnlineUser | Where-Object {$_.UserPrincipalName -like ''} | fl LineURI
Did this answer your question?