Commands › Microsoft Teams

Set-CsPhoneNumberAssignment

Microsoft Teams MicrosoftTeams Set-*

Assigns a phone number to a user or a resource account (online application instance).

Quick start script

# Set-CsPhoneNumberAssignment — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-MicrosoftTeams -CertificateThumbprint $thumb -ApplicationId $appId -TenantId $tenantId

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-CsPhoneNumberAssignment
$before | Format-List

# 3. Make the change
Set-CsPhoneNumberAssignment -EnterpriseVoiceEnabled <Boolean> -Identity <String> -LocationId <String>

# 4. Verify and diff
$after = Get-CsPhoneNumberAssignment
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax — 5 parameter sets

LocationUpdate (Default)

Set-CsPhoneNumberAssignment -TelephoneNumber <String> -LocationId <String> [-HttpPipelinePrepend <SendAsyncStep[]>]
 [<CommonParameters>]

NetworkSiteUpdate

Set-CsPhoneNumberAssignment -TelephoneNumber <String> [-HttpPipelinePrepend <SendAsyncStep[]>]
 -NetworkSiteId <String> [<CommonParameters>]

ReverseNumberLookupUpdate

Set-CsPhoneNumberAssignment -TelephoneNumber <String> [-HttpPipelinePrepend <SendAsyncStep[]>]
 -ReverseNumberLookup <String> [<CommonParameters>]

Assignment

Set-CsPhoneNumberAssignment -TelephoneNumber <String> [-LocationId <String>]
 [-HttpPipelinePrepend <SendAsyncStep[]>] -Identity <String> -NumberType <String>
 [-NetworkSiteId <String>] [-AssignmentCategory <String>] [-ReverseNumberLookup <String>] [-Notify] [<CommonParameters>]

1 more parameter sets — see the parameter table below.

Parameters (11)

ParameterTypeRequiredWhat it controls
-AssignmentCategory String This parameter indicates the phone number assignment category if it isn't the primary phone number. For example, assign a private line to a user by using `-AssignmentCategory Private`, or assign an alternate line by...
-EnterpriseVoiceEnabled Boolean yes Flag indicating if the user or resource account should be EnterpriseVoiceEnabled.
-HttpPipelinePrepend SendAsyncStep[] Specifies SendAsync pipeline steps to prepend to the generated HTTP pipeline.
-Identity String yes The identity of the specific user or resource account. You can specify the ObjectId, SipProxyAddress, or UserPrincipalName attribute of the user or resource account.
-LocationId String yes The LocationId of the location to assign to the phone number. You can get it by using Get-CsOnlineLisLocation. You can set the location on both assigned and unassigned phone numbers.
-NetworkSiteId String ID of a network site. A network site represents a location where your organization has a physical venue, such as offices, a set of buildings, or a campus.
-NetworkSiteId String yes This parameter is reserved for internal Microsoft use.
-Notify SwitchParameter Sends an email to the Teams Phone user about the new telephone number assignment.
-TelephoneNumber String yes The phone number to assign to the user or resource account. Supports E.164 format like +12065551234 and non-E.164 format like 12065551234. The phone number can't have "tel:" prefixed.
-NumberType String yes The type of phone number to assign to the user or resource account. The supported values are DirectRouting, CallingPlan, and OperatorConnect. When you acquire a phone number you will typically know which type it is.
-ReverseNumberLookup String yes This parameter controls reverse number lookup (RNL) behavior for a phone number. When RNL is set to `SkipInternalVoip`, an internal call to this phone number doesn't attempt to pass through internal VoIP by using...

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.