The Microsoft Teams admin center is a fine way to manage your enterprise voice deployment. You can assign phone numbers, set emergency locations, or view unassigned numbers. However, there is not an easy way to verify everyone’s Teams emergency address. Enter PowerShell!

In this post, you will learn how to use PowerShell to find Teams voice users’ current emergency address and export this information using PowerShell.

Note: This article originally used the Get-CsOnlineVoiceUser, which is now deprecated. This post has been updated with a new script to retrieve the same information using multiple Microsoft Teams PowerShell commands.

Connect to Microsoft Teams PowerShell

First, you need to connect a remote session to your Microsoft Teams tenant using the Connect-MicrosoftTeams PowerShell command.

Learn more about how to install and connect to your tenant in Microsoft Teams PowerShell: Install and Connect Guide.

Finding Voice-Enabled Users and Phone Numbers

If you want to retrieve all the user accounts that are currently have Teams phone system capabilities, use the Get-CsOnlineUser command and with the Filter parameter to identity users with a phone system license who are currently enabled.

Get-CsOnlineUser `
    -Filter {(FeatureTypes -contains 'PhoneSystem') -and (AccountEnabled -eq $True)} `
    -AccountType User

You can output specific user properties using Select-Object and the name of the property. For example, output the user account display name (DisplayName), user principal name (UserPrincipalName), and line URI (LineUri), which contains their assigned phone number.

Get-CsOnlineUser `
    -Filter {(FeatureTypes -contains 'PhoneSystem') -and (AccountEnabled -eq $True)} `
    -AccountType User |
    Select-Object DisplayName, UserPrincipalName, LineUri

Getting Emergency Address Information

You can view the emergency address associated with a phone number using the Get-CsPhoneNumberAssignment command. Retrieve the emergency address location information for the phone number from the previous example with the TelephoneNumber parameter.

Note the output there is the LocationId property, which is a GUID associated to an emergency location.

Get-CsPhoneNumberAssignment -TelephoneNumber +13606823750
teams phone number emergency address

Next, use the Get-CsOnlineLisLocation command and the LocationId from the results to view information about the phone number’s assigned emergency location. The location includes the address, city, state or province, country or region, and GPS coordinates.

Get-CsOnlineLisLocation -LocationId 7fc9ed20-5edc-11ee-b0fa-25ada66abc8d
detailed teams emergency address information

Breaking Down a Teams Emergency Address

Teams emergency addresses are divided into two parts: civic addresses and places. Every emergency address has a civic address. The civic address is the address of the emergency location. In the screenshot above, this would be 9407 Northeast Vanouver Mall Drive, Vancouver, WA, US.

Civic addresses can be further broken into places or locations. The primary civic address could have multiple buildings or is a multi-story building. Within the civic address, you can define places or more specific descriptors, such as Suite or Floor.

In the screenshot above, the place is Suite 104 #912. Instead of creating multiple civic addresses for a multi-floor building, you can instead define places within the location.

The CivicAddressId denotes the unique identifier for the civic address, and the LocationId denotes the more specific place of Suite 104 #912 within the associated civic address. Not every user will have a Location as their emergency address may only be the physical address.

Putting It All Together

Now that you know how to find the user’s phone number and the emergency location, here is a script to find all voice users and output a report showing the name, phone number, and emergency location information. You can include as many emergency location properties as you need.

Note in the output below it shows a phone number assigned to a user and phone number that is currently unassigned. The second phone number is also only tied to the civic address, hence the Place property is blank. Not every emergency location contains a place.

Closing

By adding a parameter to a PowerShell command, you can extract more information about your Teams voice users. You can then take this information and generate a nice report on voice users.

Questions or comments? If so, leave a comment below or find me on Twitter or LinkedIn to discuss further.