bulk block the IP addresses in exchange online?


We check the regular sign-in attempt failures in Azure ctive directory and block multiple IP addresses from the Exchange online admin center.

We have atleast 40-50 IP addresses to be blocked in each instance. I dont see any option to bulk block the IP addresses in connection filtering in exchange online.


I didn't find any PS script either. Any leads would be appreciated.

6 Replies

Use Powershell to set the Connection Filter Policy

Hope that answers your question

Best, Chris

@Christopher Hoard : thanks for your reply. 


I had one doubt: the IP addresses which I want to block do not have a specific range. For eg:


Following are the samples which I want to block:


Sometimes I have to block 200 of these different IP addresses.  Is there any other way to achieve this?

thank you again



See the examples in that article - they don’t need to be in ranges you would just have them in commas and separated by dashes.

Hope that helps!

Best, Chris
best response confirmed by Test SharePoint (Contributor)

Looks to me like you want to block auth attempts, not messages coming from those IPs, right? If so, the best way to do it is via Client Access Rules, which allow you to specify allowed/blocked IPs per protocol:


Or you can even block legacy auth altogether via auth polices:

yes, this looks good. thank you guys!