In short: Exchange Online dynamic distribution groups couldn’t use the attributes our filters relied on, and scripting static groups didn’t scale. Microsoft 365 groups with Entra ID dynamic membership did – once we tuned them to behave like distribution lists.
The challenge
On a large-scale migration project, the goal was to move all email distribution groups from a hybrid Exchange setup fully to the cloud. The regular groups also were not exactly straightforward, however, that is a different story. The question was what to do with the dynamic ones.
The customer had a few dozen very large groups of the native Exchange dynamic distribution type. On-premises, their membership is evaluated each time a message is sent to the group. In Exchange Online, the membership list is stored and refreshed once every 24 hours, which is more predictable and faster for delivery. So the obvious idea was to rebuild them in Exchange Online.
Dead end 1: rebuilding them as Exchange Online dynamic groups
Exchange Online recipient filters can only use Exchange recipient properties: standard ones such as Department, Company or City, plus CustomAttribute1–15 and the multi-valued ExtensionCustomAttribute1–5. The attributes the business actually wanted to filter on – cost centre, division, business unit, employee type – lived in the on-premises directory and reached Entra ID only as directory extension attributes. Exchange Online never saw them.
Making them usable would have meant new replication rules to copy them into Exchange custom attributes. And the standard attributes were no shortcut: the Company attribute alone held dozens of variants of what was effectively the same business. A filter built on that is long, fragile and slow.
On top of that, recipient filters have their own limits: pre-canned filters only support -and, and -like doesn’t accept a wildcard at the start of a value.
Dead end 2: maintaining regular groups with a script
Next, I tried maintaining the members of regular distribution groups in Exchange Online programmatically. This hit two walls:
- A hard limit.
Update-DistributionGroupMemberreplaces the whole member list, and its-Membersparameter accepts a maximum of 10,000 entries (Microsoft Learn). Our biggest groups were larger than that. - Speed. The fallback – read the current members, compare with the new candidates, then add and remove the differences with
Add-DistributionGroupMemberandRemove-DistributionGroupMember– meant one round trip to Exchange Online per change. With tens of thousands of members, enumerating and updating the groups was far too slow and consumed too many resources.
What worked: Microsoft 365 groups with Entra ID dynamic membership
Microsoft 365 groups can use Entra ID to update their members dynamically, based on user attributes – both standard ones and the directory extension attributes synced from on-premises. That removed the attribute problem and the scripting overhead in one go. The rule syntax is also far richer than Exchange recipient filters.
Testing was a bumpy road, because Microsoft 365 groups are not distribution lists. Each one comes with a group mailbox, a SharePoint site, OneNote and Planner, and several defaults work against the “distribution list” experience. In the end the concept was solid and performed very well. It took end users some getting used to, but it was accepted as a working solution.
How we provisioned them
Creation is a two-step process, because some settings exist only in Microsoft Graph and others only in Exchange Online. A simplified version:
# Step 1 – Microsoft Graph PowerShell: create the group
$params = @{
displayName = "All contractors"
mailNickname = "all-contractors"
groupTypes = @("Unified", "DynamicMembership")
mailEnabled = $true
securityEnabled = $false
membershipRule = '(user.employeeType -eq "Contractor") -and (user.accountEnabled -eq true)'
membershipRuleProcessingState = "On"
resourceBehaviorOptions = @("WelcomeEmailDisabled", "HideGroupInOutlook",
"SubscribeMembersToCalendarEventsDisabled", "CalendarMemberReadOnly")
"owners@odata.bind" = @("https://graph.microsoft.com/v1.0/users/<owner-object-id>")
}
$group = New-MgGroup -BodyParameter $params
# Step 2 – Exchange Online PowerShell: make it behave like a distribution list
Set-UnifiedGroup -Identity $group.Id `
-AutoSubscribeNewMembers:$true `
-HiddenFromAddressListsEnabled:$false `
-ModerationEnabled:$true `
-ModeratedBy "moderator1@contoso.com", "moderator2@contoso.com"
Creating the group through Graph has a useful side effect: no Team is created, so the group stays a plain mail-enabled group.
Settings that make a Microsoft 365 group behave like a distribution list
resourceBehaviorOptionsat creation:WelcomeEmailDisabled(no welcome email to thousands of people),HideGroupInOutlook,SubscribeMembersToCalendarEventsDisabledandCalendarMemberReadOnly.AutoSubscribeNewMembers: without it, messages land only in the group mailbox and members never see them in their own inbox. It can’t be set in the initial Graph create request, so set it straight afterwards.- Hidden from Outlook, but not from the address book.
HideGroupInOutlookalso hides the group from the global address list, so setHiddenFromAddressListsEnabledback to$falseif people should be able to find it. - Moderation instead of accepted senders. With tens of thousands of recipients, someone must approve what gets sent. Moderation can only be configured in Exchange Online (
Set-UnifiedGroup -ModerationEnabled -ModeratedBy), not through Graph. We chose it over an accepted-senders list, because accepted senders couldn’t cover external senders. - Security-enabled groups can’t hide their membership. If a group also grants access to resources,
HiddenMembershipvisibility isn’t available.
The “where is my copy?” gotcha
Senders who are members of the group don’t get a copy of their own message by default – unlike with a classic distribution list. This isn’t a group setting: it’s controlled per sender with EchoGroupMessageBackToSubscribedSender (Set-MailboxMessageConfiguration), or by each user in Outlook on the web under Settings › Groups. Plan to set it for the senders who need it, or tell users where to find it.
Writing membership rules that perform
- Prefer
-inover a chain of-orconditions. - Prefer
-eqand-startsWithover-matchand-containswherever you can. - After creating or changing a rule, check the processing status (in the Entra admin center, or via the
membershipRuleProcessingStatusproperty in Graph beta) before telling the requester the group is ready. - Expect a human step: requesters describe the audience in words, and someone has to translate that into attributes and values that actually exist in the directory.
Operational gotchas
- Licensing. Dynamic membership in Entra ID requires a Microsoft Entra ID P1 licence for each unique user who is a member of one or more dynamic groups. Check this before you commit.
- Expiration. With a group expiration policy (e.g. 365 days), owners get reminders and must renew unused groups – otherwise they disappear. Administrators can renew them too, e.g. with
Invoke-MgRenewGroup. - Group mailbox. It has a fixed quota and no archive, so retention policies are the only cleanup tool.
- Management split. The groups don’t appear in the Exchange admin center as distribution lists, and the membership rule can only be changed in Entra ID. Decide up front which team owns which part.
Want the details?
I’m happy to share more about the provisioning parameters and the order of steps that worked. Get in touch.