Hey Can anyone please send me all step by step explaintation of power shell to assign phone number to bulk user for direct routing in teams

Komal More 21 Reputation points
2022-10-17T09:17:37.883+00:00

We need to assign phone number to group of users at same time for direct routing in teams.
Please help me with step-by-step guideline.
how to create csv file, how to import file, how to execute.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,429 questions
0 comments No comments
{count} votes

Accepted answer
  1. Kael Yao-MSFT 37,656 Reputation points Microsoft Vendor
    2022-10-18T02:24:46.543+00:00

    Hi @Komal More

    Here are two similar threads which may be helpful:
    Bulk Assigning Phone Number to Microsoft Teams Users / Direct Routing

    To run the script in the thread, you may need to prepare a csv file (named with FILENAME.csv or other file names which matches the file name in the script)
    with its format like:
    251337-01.png

    Then save the following script to a ps1 file.
    (From the first line change the file path to point to the path of the csv file you prepared)

    $teams = Import-Csv "C:\Users\Temp\FILENAME.csv"  
    foreach ($team in $teams) {  
    Set-CsPhoneNumberAssignment -identity $team.identityname -PhoneNumber $team.phonenumber -PhoneNumberType DirectRouting  
    Grant-CsTenantDialPlan -PolicyName "YOURPOLICYNAME" -Identity $team.identityname  
    Grant-CsTeamsCallingPolicy -PolicyName AllowCalling -Identity $team.identityname  
    Grant-CsOnlineVoiceRoutingPolicy -PolicyName "YOURPOLICYNAME"-Identity $team.identityname  
    }  
    

    Install Teams Powershell module and connect to Teams Powershell with an account which has the required admin roles (for example Teams admin).
    Then run the script.

    For example, if the script file's path is C:\Users\TEMP\bulk_assign_number.ps1.
    Then run the following cmdlets to execute the script:

    cd C:\Users\TEMP  
    .\bulk_assign_number.ps1  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.