Get your Gateway IP address.
Sign into your Azure account and continue to Conditional access -> Named locations -> IP range location -> Set name of your Gateway + Gateway IP /32 (f.e.: 18.104.22.168/32)
Mark your location as „Trusted location“ and continue with „Create“.
The new location should now be listed.
Open „Policies“ and click on „New Policy“.
Choose your New location in the search bar on the left panel and specify who will have access.
Go back to „Home“ -> Conditional Access and open „Clouds apps or actions“. Here you can set access restrictions for all apps including Office 365.
Open Conditions (policy) -> Locations -> Choose your new Location, confirm with „Select" and „Create".