You can use [[CyberDrain Improved Partner Portal (CIPP)]] to deploy [[Transport Rules]] to [[Exchange Online]] environments.
CIPP Transport Rule Templates are written in [[JSON]]. An example is below.
```JSON
{
"name": "Mark onmicrosoft.com emails as spam",
"comments": "Created by X.",
"Priority": 1,
"SetSCL": 6,
"FromAddressContainsWords": "*.onmicrosoft.com"
}
```
I start with basics and then use the [New-TransportRule Microsoft documentation](https://learn.microsoft.com/en-us/powershell/module/exchange/new-transportrule?view=exchange-ps) to define all the settings I need.