PowerShell script for exporting Microsoft Teams user configuration to an Excel and importing user configuration with updated Excel file

I used to work with Microsoft Teams Direct Routing voice deployments quite often in the past before moving to a more Azure focused role so one of my ex-colleague recently reached out to me to ask if I had a script where we could bulk configure settings for user accounts to enable them for Enterprise Voice. There was a deployment a I’ve worked on before where there were several hundred users and all of them had already been configured for Enterprise Voice but had extensions that were not DIDs because they still had their existing PBX forward inbound calls to the SBC and then to Teams. On the day of the cutover when we move the SIP trunks to the SBC, we had to bulk update their LineURI field. The approach I took was twofold:

  1. Write a script that exported all of the users’ Teams configuration to an Excel file
  2. Write a script that imported user settings from the same spreadsheet after it was updated with the full DID extensions

The following is a sample of the export:

64

This spreadsheet was then updated to have the appropriate LineUri, which will then be used with an import script to update the settings. In addition to updating the LineUri attribute, the script will also enable Enterprise Voice, configure the dial plan and voice routing policy.

I don’t have much use for the scripts anymore given that I don’t work in the Teams space but I wanted to share them in case anyone may be looking for this.

The export script can be found here at my Github: https://github.com/terenceluk/Microsoft-365/blob/main/Teams/Export-TeamsUserConfig.ps1

The import script can be found here at my Github: https://github.com/terenceluk/Microsoft-365/blob/main/Teams/Import-TeamsUserConfig.ps1

Hope this helps!