@Taranjeet Malik Thank you for reaching out to Microsoft Q&a. I understand that you want to know how to create rule exceptions for O365, MS Teams, and Defender and also want to keep the firewall rules up to date.
Here is a list of IPs for Office 365 URLs and IP address ranges. This list also includes Skype for Business Online and Microsoft Teams IPs.
To manage access to O365 via the firewall, please refer to the Change Management for O365 IP addresses and URLs website. Changes to the Office 365 IP addresses and URLs are usually published near the last day of each month. Sometimes a change will be published outside of that schedule due to operational, support, or security requirements. Therefore, you can opt for one of the Change Management methods mentioned in the above document to get change notifications regarding the same.
Hope this helps. Please let us know if you have any further questions and we will be glad to assist you further. Thank you!
Remember:
Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
Want a reminder to come back and check responses? Here is how to subscribe to a notification.