Create and manage dial plans

After you have planned the dial plans for your organization and figured out all of the normalization rules that need to be created for call routing, you will need to use Windows PowerShell to create the dial plans and make any setting changes.

Note

The Skype for Business admin center can't be used for creating and managing dial plans.

Verifying and starting Remote PowerShell

Check that you are running Windows PowerShell version 3.0 or higher

  1. To verify that you are running version 3.0 or higher: Start Menu > Windows PowerShell.

  2. Check the version by typing Get-Host in the Windows PowerShell window.

  3. If you don't have version 3.0 or higher, you need to download and install updates to Windows PowerShell. See Windows Management Framework 4.0 to download and update Windows PowerShell to version 4.0. Restart your computer when you are prompted.

  4. You will also need to install the Windows PowerShell module for Skype for Business Online that enables you to create a remote Windows PowerShell session that connects to Skype for Business Online. This module, which is supported only on 64-bit computers, can be downloaded from the Microsoft Download Center at Windows PowerShell Module for Skype for Business Online. Restart your computer if you are prompted.

If you need to know more, see Connect to all Office 365 services in a single Windows PowerShell window.

Start a Windows PowerShell session

  1. From the Start Menu > Windows PowerShell.

  2. In the Windows PowerShell window, connect to your Office 365 organization by running:

    Note

    You only have to run the Import-Module command the first time you use the Skype for Business Online Windows PowerShell module.

  Import-Module "C:\\Program Files\\Common Files\\Skype for Business Online\\Modules\\SkypeOnlineConnector\\SkypeOnlineConnector.psd1"
  $credential = Get-Credential
  $session = New-CsOnlineSession -Credential $credential
  Import-PSSession $session

If you want more information about starting Windows PowerShell, see Connect to all Office 365 services in a single Windows PowerShell window or Connecting to Skype for Business Online by using Windows PowerShell.

Creating and managing your dial plans

You can either use a single cmdlet or a PowerShell script to create and manage tenant dial plans.

Using single cmdlets

  • To create a new dial plan, run:

    New-CsTenantDialPlan -Identity RedmondDialPlan -Description "Dial Plan for Redmond" -NormalizationRules <pslistmodifier> -ExternalAccessPrefix 9 -SimpleName "Dial-Plan-for-Redmond"
    

    For other examples and parameters, see New-CsTenantDialPlan.

  • To make setting changes to an existing dial plan, run:

    Set-CsTenantDialPlan -Identity RedmondDialPlan  -NormalizationRules <pslistmodifier> -ExternalAccessPrefix 9
      -SimpleName "Dial-Plan-for-Redmond"
    

    For other examples and parameters, see Set-CsTenantDialPlan.

  • To add users to a dial plan, run:

    Grant-CsTenantDialPlan -Identity amos.marble@contoso.com -PolicyName RedmondDialPlan
    

    For other examples and parameters, see Grant-CsTenantDialPlan.

  • To view the settings on a dial plan, run:

    Get-CsTenantDialPlan -Identity RedmondDialPlan
    

    For other examples and parameters, see Get-CsTenantDialPlan.

  • To delete a dial plan, run:

    Remove-CsTenantDialPlan -Identity RedmondDialPlan -force
    

    For other examples and parameters, see Remove-CsTenantDialPlan.

  • To see the settings of the effective dial plan, run:

    Get-CsEffectiveTenantDialPlan -Identity amos.marble@contoso.com
    

    For other examples and parameters, see Get-CsEffectiveTenantDialPlan.

  • To test the effective settings of a dial plan, run:

    Test-CsEffectiveTenantDialPlan -DialedNumber 14255551234 -Identity 1849827b-a810-40a8-8f77-e94250d4680b_US_TenantDialPlanRedmond
    

    For other examples and parameters, see Test-CsEffectiveTenantDialPlan.

Using a PowerShell script

Run this to delete a normalization rule that is associated with a tenant dial plan without needing to deleting the tenant dial plan first:

$b1=New-CsVoiceNormalizationRule -Identity Global/NR4 -InMemory
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{add=$b1}
(Get-CsTenantDialPlan -Identity RedmondDialPlan).NormalizationRules
$b2=New-CsVoiceNormalizationRule -Identity Global/NR4 -InMemory
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{remove=$b2}

Run this to add the following normalization rule to the existing tenant dial plan named RedmondDialPlan.

$nr1=New-CsVoiceNormalizationRule -Parent Global -Description 'Organization extension dialing' -Pattern '^(\\d{3})$' -Translation '+14255551$1' -Name NR1 -IsInternalExtension $false -InMemory
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{add=$nr1}

Run this to remove the following normalization rule from the existing tenant dial plan named RedmondDialPlan.

$nr1=New-CsVoiceNormalizationRule -Parent Global/NR1 -InMemory
Set-CsTenantDialPlan -Identity DP1 -NormalizationRules @{remove=$nr1}

Run the following when you want to also examine the existing normalization rules, determine which one you want to delete, and then use its index to remove it. The array of normalization rules starts with index 0. We would like to remove the 3-digit normalization rule, so that is index 1.

Get-CsTenantDialPlan RedmondDialPlan).NormalizationRules
Description         : 4-digit
Pattern             : ^(\\d{4})$
Translation         : +1426666$1
Name                : NR2
IsInternalExtension : False

Description         : 3-digit
Pattern             : ^(\\d{3})$
Translation         : +14255551$1
Name                : NR12
IsInternalExtension : False

$nr1=(Get-CsTenantDialPlan RedmondDialPlan).NormalizationRules[Number 1]
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{remove=$nr1}

Run this to find all users who have been granted the RedmondDialPlan tenant dial plan.

Get-CsOnlineuser | where-Object {$_.TenantDialPlan -eq "RedmondDialPlan"}

Run these to add the existing on-premises dial plan named OPDP1 as a tenant dial plan for your organization. You need to first save the on-premises dial plan to an .xml file, and then use it to create the new tenant dial plan.

Run this to save the on-premises dial plan to the .xml file.

$DPName = "OPDP1"
$DPFileName = "dialplan.xml"
Get-CsDialplan $DPName | Export-Clixml $DPFileName

Run this to create the new tenant dial plan.

$DPFileName = "dialplan.xml"
$DP = Import-Clixml $DPFileName
$NormRules = @()
ForEach($nr in $dp.NormalizationRules)
{
 $id1 = "Global/" +$nr.Name
$nr2 = New-CsVoiceNormalizationRule -Identity $id1 -Description $nr.Description -Pattern $nr.Pattern -Translation $nr.Translation  -IsInternalExtension $nr.IsInternalExtension -InMemory
$NormRules += $nr2
}
New-CsTenantDialPlan -Identity $dp.SimpleName -ExternalAccessPrefix $dp.ExternalAccessPrefix -Description $dp.Description -OptimizeDeviceDialing $dp.OptimizeDeviceDialing -SimpleName $dp.SimpleName -NormalizationRules $NormRules

Want to know more about Windows Powershell?

Transferring phone numbers common questions

Different kinds of phone numbers used for Calling Plans

Manage phone numbers for your organization

Emergency calling terms and conditions

Skype for Business Online: Emergency Calling disclaimer label