Make Exchange Hybrid Admin Life Easier - part 1
When you start using Office 365 in an enterprise environment you need be sure that users and your internal servers (e.g. when you maintain hybrid Exchange Server) are reachable and network traffic between them is not proxied.
The list of network requirements is published by Microsoft as the article ‘Office 365 URLs and IPs address ranges’ published here. The part of that article is the list of hosts for what network traffic need to be allowed and shouldn’t be proxied. The list is the O365IPAddresses.xml XML file and contains Office 365 subservices (e.g. comons used for managing and, Exchange Online, etc.) and IPs and URLs used to deliver them.
A XML format from its nature is not easily human readable. If you would like work with that data the file need to be downloaded, stored on a disk and opened in Excel but that required manual (so boring and prone to errors) job.
To make my life easier I wrote the PowerShell function ConvertFrom-O365AddressesXMLFIle.ps1. The function is intended for downloading and converting - to the custom PowerShell object - the list of hosts used for Office 365 services published as the O365IPAddresses.xml file.
You can download the function from Microsoft TechNet Gallery.
To use function you need to:
- download the function from Microsoft TechNet Gallery
- unblock it if for download was used Microsoft Internet Explorer
- import it to PowerShell session
- read help, specially examples included in it
To see demo of using ConvertFrom-O365AddressesXMLFIle.ps1 you can watch video published on my YouTube channel.
If you run the function in PowerShell console without any parameter
as the result the custom PowerShell object will is returned - like on the screenshot below.
Because custom PowerShell object is returned - as should be for any decent PowerShell function - you can pipe it to other PowerShell cmdlet e.g. Export-CSV.
Additionally on the disk will be stored the XML file with the name like O365IPAddresses-yyyyMMdd-HHmmss.xml (where the ‘yyyyMMdd-HHmmss’ is date and time where function was run).
The function supports also converting the file previously downloaded to a disk - the parameter Path is used for that. By default is checked a relative path ‘.\O365IPAddresses.xml’ but also any file system path can be used like
ConvertFrom-O365AddressesXMLFIle -Path C:\O365IPAddresses.xml\O365IPAddresses-20160618-211703.xml
Using ConvertFrom-O365AddressesXMLFIle.ps1 function you can
- avoid manual downloading and parsing the file
- schedule downloading the file published by Microsoft for documentation or change purposes
- The main repository for the function is located on GitHub - https://github.com/it-praktyk/Convert-Office365NetworksData.
- The function was tested with the file published between February, 23rd 2016 and June, 19th 2016.
- If you open the the O365IPAddresses.xml XML file in Excel, check the amount of rows and compare with amount of objects returned by function you can notice difference. It is by desing because empty sections are ommited in the function output. Please the screenshot below - an example based on the data downloaded from Microsoft at June, 19th 2016.
- 2016-06-19 - a remark about differences in retruned objects/rows was added.
- 2016-06-26 - the part 2 of series were published here
- 2016-06-26 - the new version was published to Microsoft TechNet Gallery - the new parameters were added