Manage Allowed Senders in Exchange Online Distribution Group via PowerShell
Question details
The user wants to manage the list of allowed senders for an Exchange Online distribution group using PowerShell.

- Product
- Exchange Online
- Device & OS
- not provided
- Scenario
- Administrating email distribution group permissions and restricting senders via the command line.
- Observed behavior
- Adding, removing, or viewing specific users who are permitted to send messages to a targeted distribution list.
Ensure you have the appropriate Exchange Online administrator permissions and have successfully connected to the Exchange Online PowerShell module.
Add or Remove Allowed Senders Using Set-DistributionGroup
Modify the list of users authorized to send messages to a specific distribution group without overwriting the entire existing list.
Using the Add and Remove hash table syntax ensures that you append or subtract specific email addresses from the allowed senders list rather than accidentally overwriting the existing permissions.
Open PowerShell as an administrator and run the standard command to connect to your Exchange Online environment using your admin credentials.
Run the command: Set-DistributionGroup -Identity "All Security Insurance" -AcceptMessagesOnlyFrom @{Add="user@example.com"}. Make sure to include the hyphen before the parameter name.
To revoke permission for a specific user, replace 'Add' with 'Remove' in the command: Set-DistributionGroup -Identity "All Security Insurance" -AcceptMessagesOnlyFrom @{Remove="user@example.com"}.

View the Current Allowed Senders List
Use the Get-DistributionGroup cmdlet to verify which users are currently permitted to send emails to your group.
Looking for a Seamless Office Experience? Try WPS Office
While managing Exchange Online requires Microsoft's administrative tools, your daily document and spreadsheet tasks don't have to be expensive or complicated. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office.

Frequently Asked Questions
Do I need special permissions to run Set-DistributionGroup?
Yes, you must be assigned the appropriate Exchange admin roles, such as the Exchange Administrator or Global Administrator role, to manage distribution groups in Exchange Online.
What happens if I omit the '@{Add=}' syntax when updating senders?
If you simply provide an email address or list of addresses without the hash table syntax (e.g., @{Add="..."}), PowerShell will overwrite the entire existing allowed senders list with only the new entries you provided.
Can I allow an entire domain to send messages to a distribution group?
The -AcceptMessagesOnlyFrom parameter is designed for individual senders. To allow groups or broader lists, you should use -AcceptMessagesOnlyFromSendersOrMembers and specify a security group containing those specific users.
How do I install the Exchange Online PowerShell module?
You can install the module by opening Windows PowerShell as an administrator and executing the command: Install-Module -Name ExchangeOnlineManagement.




