Skip to content

/errors/teams/set-csphonenumberassignment-missing-numbertype

Cannot process command because of one or more missing mandatory parameters: NumberType (Teams phone)

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
Microsoft Teams PowerShell
exit code
1
versions
MicrosoftTeams 8.0.0, Windows PowerShell 5.1
os
windows, linux, macos

Set-CsPhoneNumberAssignment : Cannot process command because of one or more missing mandatory parameters: NumberType. means you passed a user and a phone number but not the number type. To assign a number to a user or resource account, all three are required:

powershell
Set-CsPhoneNumberAssignment -Identity user1@contoso.com -TelephoneNumber +12065551234 -NumberType CallingPlan

Use DirectRouting, CallingPlan or OperatorConnect, depending on where the number comes from. -PhoneNumber and -PhoneNumberType are aliases of the two parameters, so scripts using those names fail the same way. Connect with Connect-MicrosoftTeams first; assigning numbers needs the Teams Administrator or Teams Telephony Administrator role.

Reproduce it

In a non-interactive session (as scripts run) PowerShell reports the missing parameter instead of prompting for it. MicrosoftTeams 8.0.0, no connection needed:

powershell
Import-Module MicrosoftTeams
try {
  Set-CsPhoneNumberAssignment -Identity user1@contoso.com -TelephoneNumber +12065551234 -ErrorAction Stop
} catch {
  $_.Exception.Message
  $_.FullyQualifiedErrorId
}
'Aliases of -TelephoneNumber: ' + ((Get-Command Set-CsPhoneNumberAssignment).Parameters['TelephoneNumber'].Aliases -join ', ')
'Aliases of -NumberType:      ' + ((Get-Command Set-CsPhoneNumberAssignment).Parameters['NumberType'].Aliases -join ', ')

Output

Cannot process command because of one or more missing mandatory parameters: NumberType.
MissingMandatoryParameter,Set-CsPhoneNumberAssignment
Aliases of -TelephoneNumber: PhoneNumber
Aliases of -NumberType:      PhoneNumberType

In an interactive console PowerShell asks Supply values for the following parameters: NumberType: instead.

Parameter sets

GoalCommand
Assign a number to a userSet-CsPhoneNumberAssignment -Identity USER -TelephoneNumber +E164 -NumberType CallingPlan
Assign with an emergency locationadd -LocationId (Get-CsOnlineLisLocation -City Vancouver).LocationId
Direct Routing number with extensionSet-CsPhoneNumberAssignment -Identity USER -TelephoneNumber "+1206555000;ext=1234" -NumberType DirectRouting
Only enable Enterprise VoiceSet-CsPhoneNumberAssignment -Identity USER -EnterpriseVoiceEnabled $true
Remove the numberRemove-CsPhoneNumberAssignment -Identity USER -TelephoneNumber +E164 -NumberType CallingPlan

The number can be given as +12065551234 or 12065551234, without a tel: prefix. Assigning a number also sets EnterpriseVoiceEnabled to $true.

Check the assignment

powershell
Get-CsOnlineUser -Identity user1@contoso.com | Format-List LineUri,EnterpriseVoiceEnabled
Get-CsPhoneNumberAssignment -AssignedPstnTargetId user1@contoso.com

Sources