Edit

Share via


Set-CsPhoneNumberPolicyAssignment

This cmdlet assigns a policy to a specific telephone number in Microsoft Teams.

Syntax

Default (Default)

Set-CsPhoneNumberPolicyAssignment
    [-TelephoneNumber <String>]
    [-PolicyType <String>]
    [-PolicyName <String>]
    [<CommonParameters>]

Description

The cmdlet assigns a policy to a telephone number in Microsoft Teams. This is useful in multi-line scenarios or when managing voice configurations for users who require specific dial plans or calling policies for different telephone numbers.

Please note that policies must be pre-created and available in the tenant before assignment. The list of policies that can be assigned to telephone numbers are:

  • CallingLineIdentity
  • OnlineDialOutPolicy
  • OnlineVoiceRoutingPolicy
  • TeamsEmergencyCallingPolicy
  • TeamsEmergencyCallRoutingPolicy
  • TeamsSharedCallingRoutingPolicy
  • TenantDialPlan

Assignments are effective immediately, but may take a few minutes to propagate and show up in results in Get-CsPhoneNumberPolicyAssignment cmdlet.

Examples

Example 1

PS C:\> Set-CsPhoneNumberPolicyAssignment -TelephoneNumber 17789493766 -PolicyType TenantDialPlan -PolicyName "US Admins Dial Plan"

This example assigns a policy to the specified telephone number.

Example 2

PS C:\> Set-CsPhoneNumberPolicyAssignment -TelephoneNumber 17789493766 -PolicyType TenantDialPlan

This example removes an existing TenantDialPlan previously assigned to the specified telephone number.

Parameters

-PolicyName

The name of the policy to assign. This must match an existing policy configured in the tenant.

If the telephone number already has a different policy of the same PolicyType assigned, then this will replace the existing policy assignment.

If PolicyName is not provided, then it would remove any existing policy of the same PolicyType previously assigned to the specified phone number.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PolicyType

Indicates the type of policy being assigned.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TelephoneNumber

Specifies the telephone number to which the policy will be assigned.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Identity

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

None

This cmdlet does not return output on success. Errors are thrown if the assignment fails due to invalid parameters, missing policies, or internal service issues.

If you want to verify the outcome of the assignment, call Get-CsPhoneNumberPolicyAssignment -TelephoneNumber <YourPhoneNumber>.

Notes

The cmdlet is available in Teams PowerShell module 7.3.1 or later. The cmdlet is only available in commercial cloud instances.