You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »


In This Article


Overview

This article covers provisioning a single user, and using a CSV file to provision multiple users at the same time.

Regardless of which method you use to provision your users, first connect to your Skype for Business Online services using PowerShell.  You do not need to connect to the Teams, Azure AD, or MSOL services.  If needed, review the Teams Direct Routing - 01 - Planning and Prerequisites article for details.

Make sure your user accounts have been licensed before running these commands.  They should have a license that includes MS Teams, and the Phone System license.  Details can be found in the Teams Direct Routing - 01 - Planning and Prerequisites article.


Check the User's Status

The below commands can be used to view the voice properties of one or more users.  This can be useful for checking the status of a user before and after configuring them for Direct Routing.

# Review a list of the user's properties related to Direct Routing
Get-CsOnlineUser user@domain.com | FL DisplayName, SipAddress, Enabled, InterpretedUserType, TeamsUpgrade*, EnterpriseVoiceEnabled, OnlineVoiceRoutingPolicy, TeamsVoiceRoute, TeamsCallingPolicy, VoicePolicy, HostedVoicemail*, OnPremLineURI, LineURI

# Review all of the user's properties
Get-CsOnlineUser user@domain.com | FL *

# Export a list of all voice users and their properties to a CSV file
$CsvFilePath = "C:\Path\to\file.csv"

Get-CsOnlineUser -ResultSize Unlimited | Select DisplayName, SipAddress, Enabled, InterpretedUserType, TeamsUpgrade*, EnterpriseVoiceEnabled, OnlineVoiceRoutingPolicy, TeamsVoiceRoute, TeamsCallingPolicy, VoicePolicy, HostedVoicemail*, OnPremLineURI, LineURI | Export-Csv $CsvFilePath -nti

Here's a description of the more important properties outputted with the above commands:

  • EnterpriseVoiceEnabled - Indicates whether the user has been enabled for Enterprise Voice.  Enterprise voice has to be enabled for Teams Direct Routing to work.
  • OnPremLineURI - Specifies the Evolve IP provisioned phone number assigned to the user. The phone number must be specified using the E.164 format and be prefixed with "tel:".
  • LineURI - Shows the Evolve IP provisioned phone number assigned to the user based on the value of the OnPremLineURI parameter.  If this parameter has a phone number, and OnPremLineURI is blank, the user has been assigned a phone number from Microsoft.
  • InterpretedUserType - For Teams Direct Routing to work, this should show PureOnlineSfBUser or DirSyncTeamsUser.
  • TeamsUpgradeEffectiveMode - For Teams Direct Routing to work, this should show TeamsOnly.
  • TeamsUpgradePolicy - For Teams Direct Routing to work, this should show UpgradeToTeams.
  • OnlineVoiceRoutingPolicy - When a user is configured for Teams Direct Routing, this should be set to an EIP-TDR-VRP voice routing policy.
  • TeamsCallingPolicy - If this is blank, the user is assigned to the Teams Global calling policy. To view a list of calling policies use the Get-CsTeamsCallingPolicy command.
  • VoicePolicy - When enabled for Direct Routing, this should show HybridVoice.  If it shows BusinessVoice, Direct Routing has not been enabled, and the user is set to only use Microsoft's voice environment.
  • HostedVoicemail - Indicates whether the user has enabled their voicemail. By default, all users can enable/disable their voicemail from within the Teams app.
  • HostedVoicemailPolicy - If this shows BusinessVoice, the user's voicemail is hosted by Microsoft.  At this time Evolve IP does not plan to host voice mailboxes.  So, BusinessVoice should be the value you see.
  • Enabled - Indicates whether the user is enabled for MS Teams or Skype for Business Online.  If enabled is showing False, then the user account is either disabled (sign-in is blocked), or it doesn't have a license that includes MS Teams or Skype for Business Online.



Provision a Single User


Get the name of the EIP Voice Routing Policy, which has to be entered into the below block of PowerShell code.

Get-CsOnlineVoiceRoutingPolicy | Where { $_.Identity -like "*EIP*" }


Provision the User for Direct Routing

Microsoft requires that all phone numbers be in the E.164 format.  This means the following:

  • Prefix the phone number with "tel:"
  • Include a "+" before the country code
  • No special characters or spaces to make the number human readable
# Enter the name of the EIP voice routing policy here 
$VrPolicyName = "EIP-TDR-VRP-AllCalls-East"

# Define the user's properties to enable Direct Routing
# Modify the user's UPN, and don't forget to define the user's phone number

$CsUserProp = @{
  Identity               = "user@domain.com"
  EnterpriseVoiceEnabled = $True
  OnPremLineUri          = "tel:+16105551234"
}

# This will check if the user's coexistence mode is set to TeamsOnly for Direct Routing. If not, it will be set. 
If ((Get-CsOnlineUser $CsUserProp.Identity).TeamsUpgradeEffectiveMode -ne "TeamsOnly") {
  Grant-CsTeamsUpgradePolicy -Identity $CsUserProp.Identity -PolicyName UpgradeToTeams
}

# This will configure the user's account for Direct Routing & add the account to the voice routing policy
Set-CsUser @CsUserProp
Grant-CsOnlineVoiceRoutingPolicy -Identity $CsUserProp.Identity -PolicyName $VrPolicyName


Provision from a CSV File


CSV File Requirements

Create or use an existing CSV file that contains the following required fields:

  • DisplayName - User account display Name

  • UserUPN - User account's User Principal Name (Office 365 sign in address)

  • PhoneNumber - Assigned phone number including the country code (no special characters or spaces)

  • Location - Determines which location a user will be assigned (east or west)

Here's an example:

DisplayName

UserUPN

PhoneNumber

Location

George Kastanza

jkastanza@seinfeild.com

16105551234

east

Elaine Benes

ebenes@seinfeild.com

16105551235

west


Provision Users from a CSV File

Paste the below PowerShell code into an editor like the PowerShell ISE or VSCode, and run it from there.

First, get the name of your Voice Routing Policies, which has to be entered into the below block of PowerShell code on lines 8 & 9.

Get-CsOnlineVoiceRoutingPolicy | Where { $_.Identity -like "*EIP*" }


Then define the path to your CSV file on line 5.

[CmdletBinding()]
Param ()

# Path to the CSV file
$UserData = Import-Csv "C:\Path\to\file.csv"

# Enter the name of your voice routing policies here 
$VrPolicyNameEast = "EIP-TDR-VRP-AllCalls-East"
$VrPolicyNameWest = "EIP-TDR-VRP-AllCalls-West"


# The following will loop through each entry in the CSV file and output the provisioning status to the console

ForEach ($User in $UserData) {
  
    Write-Host "`nPROVISIONING: $($User.DisplayName) ($($User.UserUPN))"

    # This will check the user's location and associate it with the correct routing policy
    If ($User.Location.trim() -eq "east") { $Vrp = $VrPolicyNameEast } 
    ElseIf ($User.Location.trim() -eq "west") { $Vrp = $VrPolicyNameWest }
    Else { Write-Host "No location defined. Continuing to next user." -ForegroundColor Yellow; Continue }

    # This will define the user's Direct Routing properties
    $CsUserProp = @{
        Identity               = $User.UserUpn
        EnterpriseVoiceEnabled = $True
        OnPremLineUri          = "tel:+$($User.PhoneNumber)"
    }

    # This will check if the user's coexistence mode is set to TeamsOnly. If not, it will be set.
    If ((Get-CsOnlineUser $CsUserProp.Identity).TeamsUpgradeEffectiveMode -ne "TeamsOnly") {
        Try {
            Grant-CsTeamsUpgradePolicy -Identity $CsUserProp.Identity -PolicyName UpgradeToTeams -ErrorAction Stop
            Write-Host "User set to TeamsOnly coexistence mode."
        } Catch { Write-Host "Failed to set user to TeamsOnly coexistence mode. Continuing to next user." -ForegroundColor Yellow; Continue }
    }

  # This will configure the user's account for Direct Routing & add the account to your voice routing policy
    Try {
        Set-CsUser @CsUserProp -ErrorAction Stop
        Write-Host "User enabled for TDR."
    } Catch { Write-Host "Failed to enable user for TDR. Continuing to next user." -ForegroundColor Yellow; Continue }
  
    Try {
        Grant-CsOnlineVoiceRoutingPolicy -Identity $User.UserUPN -PolicyName $Vrp -ErrorAction Stop
        Write-Host "User assigned a VRP: $($Vrp)"
        Write-Host "User successfully provisioned for Teams Direct Routing" -ForegroundColor Green
    } Catch { Write-Host "Failed to assign the VRP: $($Vrp)" -ForegroundColor Yellow }

} # End ForEach









  • No labels