Skype for Business Online – assigning Telephone Numbers using PowerShell

Requirement

I needed to assign a large number of telephone numbers to Skype for Business Online users.  These users are using Skype for Business Online with PSTN Calling.

Solution

In Skype for Business Online, Telephone Numbers are assigned to users with the Set-CsOnlineVoiceUser PowerShell cmdlet.

If you need instructions on how to connect to Skype for Business Online with PowerShell, see this article.

Below is the output of Get-CsOnlineVoiceUser for a Skype for Business Online user who has not been assigned a Telephone Number.

Get-CsOnlineVoiceUser -Identity steve.bush@x500.co.uk

RunspaceId: 195e1f4f-ea91-4eed-915c-b07f38a81cc1
Name: Steve Bush
Id: aaa6cba6-b936-4f47-b112-eb2bfdfd92ac
SipDomain: x500.co.uk
DataCenter: DB4
TenantId: de7b31ab-5df5-4553-8df7-af3476epfecf
Number:
LicenseState: Licensed
Location: PSTN
Connectivity: Online
UsageLocation: GB
EnterpriseVoiceEnabled: True

A Telephone Number is assigned to the user with the following command:

Set-CsOnlineVoiceUser -Identity steve.bush@x500.co.uk -TelephoneNumber +441914980037

-Identity is the identify of the target user, valid values include:

UPN: steve.bush@x500.co.uk
SIP Address: sip:steve.bush@x500.co.uk
ID: aaa6cba6-b936-4f47-b112-eb2bfdfd92ac

Below is the output of Get-CsOnlineVoiceUser when the Telephone Number is assigned.

Get-CsOnlineVoiceUser -Identity steve.bush@x500.co.uk

RunspaceId: 195e1f4f-ea91-4eed-915c-b07f38a81cc1
Name: Steve Bush
Id: aaa6cba6-b936-4f47-b112-eb2bfdfd92ac
SipDomain: x500.co.uk
DataCenter: DB4
TenantId: de7b31ab-5df5-4553-8df7-af3476epfecf
Number: 441914980037
LicenseState: Licensed
Location: PSTN
Connectivity: Online
UsageLocation: GB
EnterpriseVoiceEnabled: True

The following warning is flagged if you run the command immediately after applying the Telephone Number.  This is normal, after a minute or so the warning disappears after the TelephoneNumber is synced to the LineURI variable of the Azure AD user object.

WARNING: The telephone number and Line Uri are not match on user aaa6cba6-b936-4f47-b112-eb2bfdfd92ac. Telephone number: “441914980037”, Line Uri: “”

Assigning Telephone Numbers to Multiple Users

Create a CSV file containing the following for each user: UserPrincipalName (UPN column) and Telephone Number (DDI column).

DDIs

$DDIs = Import-CSV DDIs.csv
$DDIs | ForEach {
Set-CsOnlineVoiceUser -Identity $_.UPN -TelephoneNumber $_.DDI
}

Note: if you try and assign a LineURI with Set-CsUser as you would in a Skype for Business Server deployment, it will result in the following error.

Set-CsUser -Identity steve.bush@x500.co.uk -LineURI tel:+441914980037

Unable to set “LineURI”. This parameter is restricted within Remote Tenant PowerShell.     + CategoryInfo          : InvalidArgument: (:) [Set-CsUser] ManagementException    + FullyQualifiedErrorId : LineURI Microsoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet    + PSComputerName        : admin0e.online.lync.com

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s