Commands › Microsoft Teams

Remove-CsPhoneNumberAssignment

Microsoft Teams MicrosoftTeams Remove-*

Removes or unassigns a phone number from a user or resource account (online application instance).

Quick start script

# Remove-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
Remove-CsPhoneNumberAssignment -Identity <String> -TelephoneNumber <String> -NumberType <String>

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

Syntax — 2 parameter sets

RemoveSome (Default)

Remove-CsPhoneNumberAssignment -Identity <String> -TelephoneNumber <String> -NumberType <String>
 [-HttpPipelinePrepend <SendAsyncStep[]>] [-Notify] [-AssignmentBlockedForever] [-AssignmentBlockedDays <Integer>] [<CommonParameters>]

RemoveAll

Remove-CsPhoneNumberAssignment -Identity <String> [-HttpPipelinePrepend <SendAsyncStep[]>] [-RemoveAll]
 [-Notify] [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-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.
-TelephoneNumber String yes The phone number to unassign from the user or resource account. Supports E.164 and non-E.164 formats. The phone number can't have a "tel:" prefix.
-NumberType String yes The type of phone number to unassign from the user or resource account. The supported values are DirectRouting, CallingPlan, and OperatorConnect.
-RemoveAll SwitchParameter yes Unassigns all phone numbers from the user or resource account.
-Notify SwitchParameter Sends a best-effort email notification when a phone number is removed. Failures to send email are not reported.
-AssignmentBlockedForever SwitchParameter Sets an indefinite block on assignment for the telephone number.
-AssignmentBlockedDays Int32 Sets a duration-based assignment block on the telephone number. The value must be an integer from 1 through 365.

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