Microsoft Teams – Unassigned Number Policy

Introduction

Master the setup of an unassigned number policy in Microsoft Teams with our comprehensive guide.

This guide will provide you with steps to create an unassigned number policy in Microsoft Teams both in the admin portal and via PowerShell.

This process is typically used for directing how calls to an unassigned number range should be routed. The call can be routed to a user, an application or to an announcement service where a custom message will be played to the caller.


Requirements

  1. Global or Teams administrator
  2. Tenant must have at least one Microsoft Teams Phone Resource Account license
  3. If using PowerShell:
    1. PowerShell 5.1 or PowerShell 7.2 or later
    1. Install .NET Framework 4.7.2 or later
    1. Microsoft Teams module

These policies will apply to both inbound and outbound checked against the unassigned numbers rules.


Instructions – Admin Portal

  1. Sign in the Microsoft Admin portal: https://admin.teams.microsoft.com/
  2. Navigate to Voice > Phone Numbers > Routing Rules and select Add
  • Choose a name, description, and evaluation order for your new rule
  • Choose a rule (we will use a number range for this example):
    • Advanced – regex expression (Ex. ^(\+1410919821[6-9]\d)$)
    • Number start/end with – enter your number range (Ex. any number that starts with 410)
    • Number range – enter the start and end number
    • Single number
  • Choose a routing option (we will use a voice application/resource account in this example):
    • Greeting – upload custom greeting to play
    • Person – route to a user in the organization
    • Voice application – route to a resource account such as an auto attendant
  • Click save to create
  • The policy will now appear under the Routing rules for unassigned numbers and can be edited, tested, duplicated, or changed priority order

Instructions – PowerShell

PowerShell is especially useful for bulk operations or adding many different policies. Covene can help assist with identifying unassigned number ranges and translating them into regex expressions. Additionally, if there already exists a list of all unassigned numbers, Covene can assist in custom script creation to bulk add them via PowerShell.

  1. Run PowerShell as an administrator
  2. Install the Microsoft Teams Module
    1. Documentation: https://learn.microsoft.com/en-us/microsoftteams/teams-powershell-install
    1. Run the following commands in an administrative PowerShell:
Install-Module -Name MicrosoftTeams -Force -AllowClobber
  • Define the object to which the unassigned numbers should be routed to (user, resource account, or greeting). In this example, we will be assigning our unassigned number range to a resource account “[email protected]” – ensure the resource account is licensed and has a phone number assigned
$RAObjectId = (Get-CsOnlineApplicationInstance -Identity [email protected]).ObjectId
  • Run the command to add the unassigned number policy:
    • The target for unassigned numbers to route to is the RAObjectId defined above in step 3
    • Similar to the admin portal example, this will route all numbers 410-919-821X to [email protected]
New-CsTeamsUnassignedNumberTreatment -Identity Baltimore AA -Pattern "^\+1410919821\d{1}$" -TargetType ResourceAccount -Target $RAObjectId -TreatmentPriority $Prio
  • Full code to run at once:
$RAObjectId = (Get-CsOnlineApplicationInstance -Identity [email protected]).ObjectId
New-CsTeamsUnassignedNumberTreatment -Identity Baltimore AA -Pattern "^\+1410919821\d{1}$" -TargetType ResourceAccount -Target $RAObjectId -TreatmentPriority 3
  • Once complete, you will see the successful output in the PowerShell window indicate the following and this can further be validated in the admin portal:

Additional examples and official documentation can be found here: https://learn.microsoft.com/en-us/powershell/module/teams/new-csteamsunassignednumbertreatment?view=teams-ps


Reference

The below website provides additional instruction for utilizing this process.

https://learn.microsoft.com/en-us/microsoftteams/routing-calls-to-unassigned-numbers


Want More?

Curious about our Microsoft-based solutions? Discover our range of services by clicking here!


Discover more from Covene

Subscribe to get the latest posts sent to your email.

Leave a Reply