Hope you are doing well.
Below link talks about Implementing Tenant Restrictions for Microsoft Office 365:-
This solely is not avaialble through policy creation in cloud .
In order to achive this you will need to use web hybrid setup wherein policies from on prem MWG will be synced to cloud.
This granular policy creation for tenant restrictions using header modifications is possible in on prem MWG but not solely on cloud.
Download the new ePolicy Orchestrator (ePO) Support Center Extension which simplifies ePO management and provides support resources directly in the console. Learn more about ePO Support Center