Set-CsUser : This cmdlet has been deprecated. Use the new Set-CsPhoneNumberAssignment
The Old Command Let Set-CsUser
Usually, we enable a user for Teams Direct Routing using the command let:
Set-CsUser -Identity user1@example.com -OnPremLineURI “tel:+xxxxxxxxxxxx;ext=xxxx”-EnterpriseVoiceEnabled $true -HostedVoiceMail $true
The Error When Using the Old Command Let
But right now, if you use this command, you will get the error message
WARNING: OnPremLineURI will be deprecated. Please use LineURI to update user’s phone number.
Set-CsUser : This cmdlet has been deprecated. Use the new Set-CsPhoneNumberAssignment and
Remove-CsPhoneNumberAssignment cmdlets instead. Refer documentation for more details.
At line:1 char:1
+ Set-CsUser -Identity user1@example.com -OnPremLin …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ UserId = Team…onaryOfString }:<>f__AnonymousType104`2) [Set-CsUse
r], Exception
+ FullyQualifiedErrorId : InternalServerError,Microsoft.Teams.ConfigApi.Cmdlets.SetCsUser
As shown in the following image

The New Command Set-CsPhoneNumberAssignment
You cannot use the command Set-CsUser to assign phone number to a user. Instead, you need to use the command Set-CsPhoneNumberAssignment as follows:
Set-CsPhoneNumberAssignment -Identity user1@example.com -PhoneNumber “+xxxxxxxxxxxx;ext=xxxx ” -PhoneNumberType DirectRouting

The Newly Needed Parameter
You must use the last parameter -PhoneNumberType DirectRouting since you are using Direct Routing. Otherwise, Set-CsPhoneNumberAssignment command let will fail.
The Old Parameters
When we were using the old command Set-CsUser, we used to use the following two paraments:
-EnterpriseVoiceEnabled $true
-HostedVoiceMail $true
Enterprise Voice Enabled
Regarding the “Enterprise Voice Enabled” flag, it will be set to true automatically when you set -PhoneNumber to the phone number of the user
But right now, with Set-CsPhoneNumberAssignment, there is no need to use these two parameters (provided that you are using -PhoneNumberType DirectRouting)
Hosted Voice Mail
Regarding Hosted Voice Mail flag, according to the documentation of Set-CsPhoneNumberAssignment, setting HostedVoiceMail for Microsoft Teams users is no longer necessary.
