steven_layton_sl Posted September 30, 2024 Posted September 30, 2024 Hi We are a MAT, currently with 9 schools. We use M365, with each school having its own email domain. We'd like to prevent students in one school from email students in another school, but to allow students within the same school to email between themselves. We're trying to create some structured rules within M365/Exchange to configure this, but without having to have a myriad of individual rules for each school. I'm sure we can't be the only MAT to need to do this. Can anyone point us in the right direction?
foofighterjim Posted September 30, 2024 Posted September 30, 2024 Not a block as such, but this is on my to do list: https://learn.microsoft.com/en-us/exchange/address-books/address-book-policies/address-book-policies
mavhc Posted September 30, 2024 Posted September 30, 2024 Luckily not letting parts of companies talk to each other is a legal requirement, so it's built in https://learn.microsoft.com/en-us/purview/information-barriers
steven_layton_sl Posted October 1, 2024 Author Posted October 1, 2024 (edited) Thanks guys. A colleague did some research and wrote the following PowerShell command which he ran through the Exchange online PowerShell module. New-TransportRule "Block student inter-school comms" -SenderADAttributeMatchesPatterns "userPrincipalName: [0-9]+@[A-Za-z0-9]+-xxx\.xx" -ExceptIfADComparisonAttribute Company -RejectMessageReasonText "Messaging students outside your school is prohibited." The above command does the following - -Creates a new transport rule called - "Block student inter-school comms" -The rule checks that the sender is a student by matching their userPrincipleName to the following a RegEx matching our students username format -The rule then checks if the sender and recipient have different values in the "company" attribute that match our school codes -If the sender and recipient have the same "company" attribute value, the message is delivered -If the sender and recipient have the different "company" attribute values, the message is rejected with the message: "Messaging students outside your school is prohibited." Edited October 1, 2024 by steven_layton_sl
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now