PowerShell Script: Retrieve all Office 365 URLs and IP Ranges

This week I took the Office 365 Performance Management course on the Microsoft Virtual Academy. If you have any plans using Office 365 I strongly recommend taking this course. One of the topics that was often highlighted is the importance of having all Office 365 URLs and IP Ranges configured on the outbound allow list. The Office 365 URLs and IP Ranges are documented here and the changes to the list are described here.

As part of my continuous PowerShell skill improvement activity, I thought I write a script to retrieve this information via PowerShell. Microsoft has stored  the URL and IP address information into tables on this page, but thanks to Lee Holmes Get-WebRequestTable script I could loop through the various tables that contain the URL and IP address range information stored on the page.

The Get-Office365URLIPInfo script can be downloaded from the Microsoft TechNet Gallery here.

 

When you run the script, you get a list of all URLs or IP Ranges and the related Service.

office365

5 Replies to “PowerShell Script: Retrieve all Office 365 URLs and IP Ranges”

Leave a Reply

Your email address will not be published. Required fields are marked *