Warning: Please verify the imported normalization rules include a rule for emergency services. If not, calls will not be able to be placed to emergency services.


The following PowerShell script will prompt for the end user's user principle name and when completed, open a notepad file with the normalization rules in a format that can be imported into Attendant Console. 

1. Run the PowerShell script below (No editing is required before running the script.) 

2. Once the notepad appears with the normalization rules, save the file. 

3. Open Attendant Console > Settings > Import / Export Setting tab > Import a File button > Select the saved file.


$module = Get-InstalledModule MicrosoftTeams -ErrorAction SilentlyContinue
If (!$module -or $module.Version -lt [Version]'3.1.1'){
    throw "Please install or update to the latest Teams PowerShell Module."
}
Connect-MicrosoftTeams
clear-host
$UPN = Read-Host -Prompt "Enter the End User's User Principal Name and press Enter"
$ExportFilePath = $env:TEMP + "\NormalizationRules.txt"
$chars = "abcdefghijkmnopqrstuvwxyz23456789".ToCharArray()
$Normalizationrules = [PSCustomObject]@{}
$DialPlans = @()
$DPs = ((Get-CsEffectiveTenantDialPlan -Identity $UPN -ErrorAction Stop).normalizationrule)
foreach ($DP in $DPs){
    $object = [PSCustomObject]@{}
    $legancyPointer = $DP -split "LegacyPointer="
    $IsInternalExtension = ($legancyPointer[0] -split "IsInternalExtension=")
    $Name = ($IsInternalExtension[0] -split "Name=") 
    $Translation = ($Name[0] -split "Translation=") 
    $Pattern = ($Translation[0] -split "Pattern=") 
    $description = ($Pattern[0] -split "Description=") 
    $object | Add-Member -MemberType NoteProperty -Name "key" -Value (-join ($chars | Get-Random -Count 10))
    $object | Add-Member -MemberType NoteProperty -Name "description" -Value ($Name[1] -replace ".$")
    $object | Add-Member -MemberType NoteProperty -Name "translation" -Value ($Translation[1] -replace ".$")
    $object | Add-Member -MemberType NoteProperty -Name "pattern" -Value ($Pattern[1] -replace ".$")
    $DialPlans+=$object
}
$Normalizationrules | Add-Member -MemberType NoteProperty -Name "normalizationRules" -Value $DialPlans
$Normalizationrules | ConvertTo-Json | Out-File $ExportFilePath
notepad.exe $ExportFilePath