Some firewalls have FQDN capability (e.g., Watchguards), which makes careful rule creation practical for a behemoth like Microsoft Office 365 and all of its related services. The info below is condensed and sorted from here. I have omitted a very few items (e.g., ports 25, 143, 465, and 993, and *.msn.com), for reasons which I hope are reasonably obvious.
Create one rule with these ports:
80, TCP
443, TCP
587, TCP
3478-81, UDP
5223, TCP
50000-59999, TCP and UDP
to the following list of locations, and it is done.
*.aadrm.com *.aadrm.com *.aka.ms *.apple.com *.aspnetcdn.com *.aspnetcdn.com *.assets-yammer.com *.azure.com *.azure.net *.azureedge.net *.azurerms.com *.azurerms.com *.azurewebsites.net *.cloudapp.net *.cloudapp.net *.cloudappsecurity.com *.cloudfront.net *.edgekey.net *.edgesuite.net *.getmicrosoftkey.com *.gfx.ms *.live.com *.lync.com *.microsoft.com *.microsoftazuread-sso.com *.microsoftonline.com *.microsoftonline-p.com *.microsoftonline-p.com *.microsoftonline-p.net *.microsoftonline-p.net *.microsoftstream.com *.msappproxy.net *.msecnd.net *.msecnd.net *.msecnd.net *.msecnd.net *.msedge.net *.msft.net *.msftauth.net *.msocdn.com *.mstea.ms *.o365weve.com *.office.com *.office.net *.office365.com *.onedrive.com *.onenote.com *.onenote.net *.onestore.ms *.onmicrosoft.com *.optimizely.com *.outlook.com *.phonefactor.net *.sfbassets.com *.sfx.ms *.sharepoint.com *.sharepointonline.com *.skype.com *.skypeassets.com *.skypeforbusiness.com *.sway.com *.sway-cdn.com *.sway-extensions.com *.tenor.com *.trafficmanager.net *.trafficmanager.net *.virtualearth.net *.visualearth.net *.visualstudio.com *.windows.net *.windowsazure.com *.windowsazure.com *.yammer.com *.yammerusercontent.com ajax.googleapis.com ms.tific.com