Forum Discussion

Dobongsoon's avatar
Dobongsoon
Brass Contributor
Feb 23, 2022
Solved

Microsoft Teams Phone Number Attribute in Active Directory

Hi,

 

I need to find users in Active Directory who have no Telephone number entry in the AD field but with assigned phone numbers in Teams?  I have to type the phone number in Active Directory manually.  I need to find a report or solution, so I could update our AD if the person in our team already assigned a phone number in Teams.  Any solution to this?  Thank you.

  • somnio0505 Thank you for the information.  This confirms that there is no direct attribute between the two, and that the information lives in two different environment.  I will check out the script. I appreciate the time and help on this.

5 Replies

  • Carl_Karawani's avatar
    Carl_Karawani
    Brass Contributor

    There's a great write up here that shows exactly how to do this using the Teams Powershell Module. There's even a script provided that can connect to your teams tenant to grab the LineURIs of users and then update the AD telephoneNumber attribute:
    https://goziro.com/how-to-sync-microsoft-teams-phone-numbers-with-active-directory/

  • somnio0505's avatar
    somnio0505
    Brass Contributor

    Hi, Dobongsoon 

     

    If there is no simple way, how about trying to sync with powershell commands.

     

    1. Get all Teams users phone number  (using 'MicrosoftTeams' module) 

    $teamsUsers = Get-CsOnlineUser | Select-Object UserPrincipalName, LineURI

     

    2. Compare phone number between AD and Teams.

     

    (Get-ADUser -Identity $teamsUser -Properties *).Mobile

     

    3. If there is difference, overwrite AD att.

     

    ##

    I didn't write the full script.
    It seems that it can be applied using the above command and foreach syntax.

     

    Thanks.

     

     

     

    • Ismet_IT's avatar
      Ismet_IT
      Copper Contributor

      somnio0505 

      Can you maybe help me creating the same type of script but then the other way around. Im looking for a way to update phonenumbers of teams users by using the on prem ad.

       

      Kind regards,

      Ismet IT

    • Dobongsoon's avatar
      Dobongsoon
      Brass Contributor

      somnio0505 Thank you for the information.  This confirms that there is no direct attribute between the two, and that the information lives in two different environment.  I will check out the script. I appreciate the time and help on this.

Resources