After you have assigned the correct licenses, the next step is to configure the user’s online phone settings. You’ll perform these steps using Teams PowerShell module.
To establish a remote PowerShell session with Teams, you first need to install the Teams PowerShell module.
After you install the module, you can establish a remote session with the following cmdlet:
Connect-MicrosoftTeams
You will typically enable Teams Phone functionality and assign a number available to you from your voice provider. As you enable Teams Phone for a user, voicemail will be automatically enabled at the same time.
To enable a user for Teams Phone functionality and assign a Microsoft Calling Plan phone number, use the following cmdlet:
Set-CsPhoneNumberAssignment -Identity "<User name>" -PhoneNumber "<phone number>" -PhoneNumberType CallingPlan
Supports E.164 format like +12065551234 and non-E.164 format like 12065551234. The phone number can’t have “tel:” prefixed.
Direct Routing numbers with extensions using the formats +1206555000;ext=1234 or 1206555000;ext=1234 are supported, but such phone numbers can’t be assigned to a resource account.
The example below shows how to assign Direct Routing number with a unique extension to the user:
Set-CsPhoneNumberAssignment -Identity "[email protected]" -PhoneNumber "+14255551234;ext=1001" -PhoneNumberType DirectRouting
The following cmdlet shows how to assign the same number with a different extension to another user:
Set-CsPhoneNumberAssignment -Identity "[email protected]" -PhoneNumber "+14255551234;ext=1002" -PhoneNumberType DirectRouting
If a user or resource account has a phone number set in Active Directory on-premises and synched into Microsoft 365, you can’t use Set-CsPhoneNumberAssignment to set the phone number. You will have to clear the phone number from the on-premises Active Directory and let that change sync into Microsoft 365 first. Then enable the user for enterprise voice services and voicemail using the following cmdlet:
Set-CsPhoneNumberAssignment -Identity "<User name>" -EnterpriseVoiceEnabled $true
Assign a voice routing policy
After configuring a phone number for the user and enabling the user for voicemail, you will then assign a voice routing policy to the user. This policy allows the user to dial out and receive calls by associating them with specific Direct Routing configuration:
Grant-CsOnlineVoiceRoutingPolicy -Identity "<User name>" -PolicyName "No Restrictions”