In This Article


Overview

This article covers deprovisioning users for Teams direct routing in the Teams Admin Center (TAC) and PowerShell. 

NOTE

After deprovisioning a user, you can remove their Teams Phone add-on license.  If you are switching the user to use Microsoft's voice environment, keep the Teams Phone add-on license assigned, and then add a Microsoft calling plan license.

WARNING 

Do not remove the Teams Phone add-on license to de-provision a direct routing user. 

Removing the Teams Phone add-on license will not clear the user's direct routing configuration.  Also, the phone number assigned to the user will remain associated with the user account, and it cannot be assigned to another user until it is cleared, or you delete the user account from your environment.

If you need to clear the phone number from an unlicensed user account, you will need to re-assign the Teams Phone add-on license, and properly de-provision the user.


Deprovision Using the Teams Admin Center

These steps show you how to deprovision a single user account for Teams direct routing in the Teams Admin Center (TAC).  The TAC does not provide any feedback on a user's current direct routing status.  If you need to check the status of a user's configuration, or do any troubleshooting, you should use PowerShell. 

NOTE

Make sure the user account is still properly licensed before removing their direct routing configuration.  Do not remove the Teams Phone add-on license to de-provision a direct routing user.  The user account should have a license that includes MS Teams, and the Teams Phone add-on license.  Details on licensing requirements can be found in the Teams Direct Routing - 01 - Planning and Prerequisites article.


Sign into the Teams Admin Center (TAC):  https://admin.teams.microsoft.com 

Remove a Direct Routing Phone Number

Users > Manage Users > Click on a user's Display Name to view their settings

Next to General Information, click Edit.


In the right-hand flyout pane, clear the assigned phone number.


Click the Apply button at the bottom of the flyout pane.


The user account's properties will update to show the phone number removed.


Remove the Voice Routing & Tenant Dial Plan Policies

Select the user account's Polices tab


Edit the Assigned Policies


In the right-hand flyout pane, towards the bottom of the policy list, select the Global policy configuration for the following:

  • Dial Plan:  Global (Org-wide default)
  • Voice Routing Policy:  Global (Org-wide default)


Click the Apply button at the bottom of the flyout pane.


The user's policy assignments will update to show the applied changes.


NOTE

It can take up to 24 hours for Microsoft's services to apply the changes.  Normally it takes 10-30 minutes.



Deprovision Using PowerShell

These steps show you how to deprovision one or more user accounts from Teams direct routing using PowerShell.  Before performing these steps make sure you are connected to your Microsoft Teams services using PowerShell.  If needed, review the Teams Direct Routing - 01 - Planning and Prerequisites article for details.

Check the User's Status

The below commands can be used to view the voice properties of a user.  This can be useful for checking the status of a user before and after deprovisioning.

# Review a list of the user's properties related to Direct Routing
Get-CsOnlineUser user@domain.com | FL Displ*, UserPri*, SipA*, IsSipEnabled, Inter*, TeamsUpgradeE*, Enterprise*, OnlineVoiceR*, TeamsCall*, TenantD*, OnlineDial*, 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 2147483647 | Select Displ*, UserPri*, SipA*, IsSipEnabled, Inter*, TeamsUpgradeE*, Enterprise*, OnlineVoiceR*, TeamsCall*, TenantD*, OnlineDial*, LineURI | Export-Csv $CsvFilePath -nti


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

  • IsSipEnabled - Indicates whether the user is enabled for MS Teams.  If this is showing False, then the user account cannot be configured for direct routing.
  • EnterpriseVoiceEnabled - Indicates whether the user has been enabled for Enterprise Voice features (aka. Teams Phone).  Enterprise voice has to be enabled for Teams Direct Routing to work.
  • LineURI - Shows the provisioned phone number assigned to the user. 
  • InterpretedUserType - This can help with troubleshooting users that are not working as expected.  Unfortunately, there's a lot of "UserTypes", and Microsoft does not have them documented.  People in the Teams community have tried creating some documentation of their own, and doing a Google search for InterpretedUserType will turn up some results, which may help.  If not, you'll need to open a support case with Microsoft.
  • TeamsUpgradeEffectiveMode - For Teams direct routing to work, this should show TeamsOnly.
  • OnlineVoiceRoutingPolicy - If this is blank, the user is not assigned a voice routing policy.  When a user is configured for Teams direct routing, this should be set to an Evolve IP voice routing policy.  To view a list of voice routing policies in your tenant use the Get-CsOnlineVoiceRoutingPolicy command.
  • TenantDialPlan - If this is blank, the user is assigned to the Global tenant dial plan. To view a list of dial plans in your tenant use the Get-CsTenantDialPlan command.
  • TeamsCallingPolicy - If this is blank, the user is assigned to the Global calling policy. To view a list of calling policies use the Get-CsTeamsCallingPolicy command.
  • TeamsCallParkPolicy - If this is blank, the user is assigned to the Global call park policy. To view a list of call park policies use the Get-CsTeamsCallParkPolicy command.
  • OnlineDialinConferencingPolicy - If this shows ServiceAllowed, the user is enabled for Microsoft's Audio Conferencing.  If this is blank, the user is not enabled for Audio Conferencing.
  • OnlineDialOutPolicy - This policy defines the dial out restrictions from an audio conference.  A table of the different policies and their restrictions can be found in this Microsoft article.


Deprovision a Single User

The following will deprovision a single user from direct routing, and disable their Enterprise Voice features.  When you're done, you can then remove the Teams Phone add-on license from the user account.  This change will not affect any Audio Conferencing features.

Deprovision the User from Direct Routing.  Make sure you modify line 2 to include the user's UPN.

# Define the user's UPN
$UPN = "user@domain.com"

# This will deprovision the user's account for Direct Routing
# and set their account to use the global voice routing policy

Grant-CsOnlineVoiceRoutingPolicy -Identity $UPN -PolicyName $null
Grant-CsTenantDialPlan -Identity $UPN -PolicyName $null 
Remove-CsPhoneNumberAssignment -Identity $UPN -RemoveAll 


Deprovision All Users

The following will deprovision all users that are currently configured with Direct Routing using an Evolve IP voice routing policy, and also disables their Enterprise Voice features.  When you're done, you can remove the Teams Phone add-on license from the user accounts.  This change will not affect any Audio Conferencing features.

Get all users assigned to an EIP voice routing policy.

# Search string to find the EIP voice routing policies 
$VrPolicyName = "EvolveIP"

# Get all users assigned to an Evolve IP voice routing policy
$UserData = Get-CsOnlineUser -ResultSize 2147483647 | Where { $_.OnlineVoiceRoutingPolicy -like "*$($VrPolicyName)*"}

# Show a list of the users assigned to an EIP voice routing policy
$UserData | FT DisplayName, UserPrincipalName, OnlineVoiceRoutingPolicy, OnPremLineUri

# Show the number of users assigned to an EIP voice routing policy
$UserData.UserPrincipalName.Count

Deprovision the list of users, and disable their Enterprise Voice features.

# This will loop through each user
ForEach ($User in $UserData) {

  # These commands will deprovision the user's account for direct routing
  # and set their account to the global voice routing policy

  Grant-CsOnlineVoiceRoutingPolicy -Identity $User.UserPrincipalName -PolicyName $null
  Grant-CsTenantDialPlan -Identity $User.UserPrincipalName -PolicyName $null
  Remove-CsPhoneNumberAssignment -Identity $User.UserPrincipalName -RemoveAll
}