Thank you for reaching out.
I understand you wish to allow Office 365 traffic for the VM deployed behind an Azure Firewall.
For azure firewall you can use service tags to allow required IP addresses of Office365 services.
You can follow the documentation here to implement the Firewall rules
You can use the Azure Firewall built-in Service Tags and FQDN tags to allow outbound communication to Office 365 endpoints and IP addresses.
Just FYI Office 365 service tags and FQDN tags are supported in Azure Firewall policy only. They aren't supported in classic rules.
- FQDN tag represents only the required FQDNs for the specific product and category that communicate over HTTP/HTTPS (ports 80/443) and can be used in Application Rules to secure traffic to these FQDNs and protocols.
- Service tag represents only the required IPv4 addresses and ranges for the specific product and category and can be used in Network Rules to secure traffic to these IP addresses and to any required port.
Additional references:
Hope this helps! Please let me know if you have additional questions. Thank you!