Graph API to export PSTN usage

Leverage Graph API to export and report PSTN usage.

Microsoft recently released the ability to programmatically retrieve Microsoft Teams PSTN usage records using the Graph API. This data is currently available in the Teams admin center under Analytics & Reports > Usage Reports > PSTN & SMS Usage.

Inspired by Lee Ford’s Get-TeamsPSTNCallRecords script, Jeff Brown wrote a new version of the module to work with the Graph API to retrieve these records. Jeff approached the solution in a different way:

  • Ability to create and use a Graph API access token without storing the client secret password in the script
  • Separate commands for retrieving calls from both Calling Plans & Direct Routing
  • Use Export-Csv or ConvertTo-Json to export the data to the desired format.
  • Specify the start and end dates or the last number of days to retrieve the records

Check out the module code and some instructions for setting up the Azure application registration, importing the module, and some sample commands in JeffBrown’s GitHub repository:
GitHub: JeffBrownTech / TeamsCloudCommunicationApi

You can download the module directly from the PowerShell Gallery with the following command:

Installmodule -name TeamsCloudCommunicationApi

PS: This Graph API is currently in beta and is not recommended for production so use at your own risk. You can learn more about the Cloud Communication API through Microsoft Docs here: Working with Communications API in Microsoft Graph