In This Article |
This article covers de-provisioning users from Teams Direct Routing.
After de-provisioning a user, you can remove their Phone System license. If you are switching the user to use Microsoft's voice environment, keep the Phone System license assigned, and then add a Microsoft calling plan license. |
WARNING: Do not remove the Microsoft Phone System license to de-provision a direct routing user. That will not completely clear the user's configuration. The phone number assigned to the user will remain associated with the user account, and it cannot be cleared until you delete the user account from your environment, or re-add the Phone System license and properly de-provision the user. |
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*, Enabled, Inter*, TeamsUpgradeE*, Enterprise*, OnlineVoiceR*, TeamsCall*, TenantD*, VoiceP*, HostedVoicemail*, OnlineDial*, 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 Displ*, UserPri*, SipA*, Enabled, Inter*, TeamsUpgradeE*, Enterprise*, OnlineVoiceR*, TeamsCall*, TenantD*, VoiceP*, HostedVoicemail*, OnlineDial*, OnPremLineURI, LineURI | Export-Csv $CsvFilePath -nti |
Here's a description of the more important properties outputted with the above commands:
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 Phone System 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 Set-CsUser -Identity $UPN -OnPremLineUri $null -EnterpriseVoiceEnabled $False |
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 Phone System 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 Unlimited | 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 Set-CsUser -Identity $User.UserPrincipalName -OnPremLineUri $null -EnterpriseVoiceEnabled $False } |