BPOS allowed a simple UI method to maintain a block list for incoming email to your hosted Exchange service. Office365 has no such simplified implementation and instead offers full access to create transport rules in Exchange. The rules can be created either through the web management UI or via PowerShell as below:
Save the following text as “BlockDomain365.ps1″ and run … > .\BlockDomain365 webring.com
if($args.length -eq 0) {Write-Warning "You must provide a domain to block (i.e. domain.com)" ; break}
else {$domainToBlock=$args[0]}
Write-Host "Adding Transport Rule to block" $domainToBlock
$transportRuleName = "Block_" + $domainToBlock
Import-Module MSOnline
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
New-TransportRule -Name $transportRuleName -FromAddressContainsWords $domainToBlock -RejectMessageEnhancedStatusCode "5.7.1" -RejectMessageReasonText "SPAM: all email filtered from this domain"
Get-TransportRule $transportRuleName
Remove-PSSession $Session