Add the new user creation number to team

Add the new user creation number to team

Hello everybody,
I hope to find near you a solution to my problem.
Here is the problem:
I have a test template for creating user accounts on our active directory and also on Office 365 and the skype line (we are in a hybrid environment).
For a few months, we have switched to Teams Only mode and this automatically leads to the deletion of the skype part on my template. however, I cannot get the TELEPHONE NUMBER line from my template to match Teams.
I set up a script on the custom attributes part (see image and script) but, I don't know if this one is ok to automatically assign the number to the user when creating the account.
would it be possible to help me?
I am running out of solution.

  1. #connection
  2. $param1=$args[0]

  3. Import-Module SkypeOnlineConnector
  4. $userCredential = Get-Credential
  5. Connect-MicrosoftTeams -credential $usercredential
  6. Connect-AzureAD -Credential $usercredential
  7. #add user to Team

  8. $args[0]
  9. set-csuser -Identity $args[0] -EnterpriseVoiceEnabled $True -HostedVoiceMail $true

  10. #user policy
  11. Grant-CsTeamsUpgradePolicy -Identity $args[0] -PolicyName UpgradeToTeams
  12. Grant-CsTenantDialPlan -Identity $args[0] -PolicyName 'MyPolicy'





                New to ADSelfService Plus?