We are importing emails from CSV to add in bulk to block with Transport rules.
Use
Connect-ExchangeOnline
If the module is not installed, use
Install-Module -Name ExchangeOnlineManagement


Am saving them as Strings. Otherwise, Set-Transportrule will hang without any response. as its saves with non standard format
[String[]] $Newlist = Get-Content "C:\BlockEmail\blocked_addresses_unique_dos.csv" [String[]] $Oldlist = (get-transportrule bounce).from [String[]] $All = $Newlist + $Oldlist | select -Unique Set-TransportRule bounce -from $All Write-Host "Updating [$all] to Bounce"
if you want to test without csv
[String[]] $Newlist = "x@y.com,"y@g.com"