Listing Office 365 Endpoints using PowerShell

An essential part of a successful deployment of Office 365 is to make sure connectivity is optimal and that there are no restrictions being applied for the public endpoints of the service among other factors. this is all detailed on the Office 365 Network Connectivity Principles documentation.

A good overview of the concept was delivered at Ignite 2019 – BRK3000 – Strategies for building effective, optimal and future proof connectivity to Office 365 that will delight your users

One of the tasks is to read the list of the endpoints from the Office 365 URLs and IP address ranges documentation page, due the dynamic nature of the endpoint list a Web Service was made available to ease automation, reporting and 3rd party solutions.

Most of the times, you’ll just want to fetch the list of the URLs, and hand them over to your friendly networking team that would then do their magic. lucky enough PowerShell can be used to get that list easily, here’s an  example:

$endpoints = Invoke-WebRequest "" | ConvertFrom-Json ; $endpoints | ?{$_.serviceArea -eq "Common" -AND $_.Required -eq "True"} | select urls -ExpandProperty Urls

This would request the full list of endpoints from the web service, convert it PowerShell objects from Json and output only the Common Services which are also tagged as Required and list only the Urls.

Another example would be to pull the Optimize category:

$endpoints = Invoke-WebRequest "" | ConvertFrom-Json ; $endpoints | ?{$_.category -eq "Optimize" }


One thought on “Listing Office 365 Endpoints using PowerShell”

Leave a Reply