Dynamically Distributing

One of the goals of this blog was to make me filthy rich so I could buy a yacht. The other was to help reveal some of the cooler Office 365 features to people that otherwise may have overlooked them. So on that note I want to show you an easy way to create a global mail group for everyone on your tenant. I don’t know of a single project that I’ve worked on where we haven’t been asked to create such a group within 3-4 days of setting up the tenant.

Office 365 offers a feature called Dynamic Distribution Groups (DDG). With a DDG you can set a pre-defined set of characteristics and any recipient (contact, mail user, mailbox, etc) will automatically be added to the group in real time. We’ve made groups where based on the state on the user’s profile they were added to 1 of 50 DDGs (hint: there are 50 states in the US). Because DDGs update without any manual intervention, as soon as someone emails California@Get-MSOL.com, Office 365 will look for all users who have CA set as their state and route the message to them on the fly.

The most basic DDG is the AllMailusers group. Simply put, this group will dynamically contain all users with an exchange online mailbox. To set one up first sign into the Exchange Online Control Panel and from the Recipients section move over to the Groups tab. Start creating your new DDG by clicking the + sign and selecting Dynamic Distribution Group.

In the resulting options window shown below, begin filling out how you’d like the group to look. I’ve gone ahead and filled in an example below but here is the impact of each field.

Display name – This will be the name that users see in the global address book. I’ve added an underscore in front of it so that it will appear at the top. On some projects I’ve been asked to add zz at the front so it appears at the bottom. The choice is yours!

Alias – The alias will determine the first email address assigned to this group. By default the primary address of this group will be {alias}@{default domain}. If you never changed your default domain from the .onmicorosoft.com address you were issued when you setup your tenant don’t worry because we’ll show how to change this later on.

Description – This field is not required but it doesn’t hurt to add in a little something for curious Outlook users.

Owner – Again, not required since there is no membership to manage but if you ever want to enable Message Approval then you’ll need an owner unless you specify moderators. Message Approval basically means that if someone wants to email this DDG then a Moderator has to approve the message before it’s sent, if no Moderators are specified then the privilege falls to the Owner. In a large company this can be helpful to avoid Norma in accounting from spamming 14,582 users about Sunday’s bake sale for her son’s hockey team. Norma is an awful baker and everyone knows it.

Members – Here’s where we really get down to business. The settings in my example will prevent these messages from hitting mail contacts, and mail users (non-mailbox owners). It will however hit all internal users with mailboxes and any shared or resource mailboxes. Feel free to tweak this as desired.

Rules – For now we’re not going to add any rules. If you get bored one day then I invite you to dive in and play around with the various filters such as State, Department, and custom AD attributes.

With the desired settings in place hit Save. Highlight your new DDG and click the pencil icon to begin editing it. The first setting you may want to change is on the Delivery Management tab, this setting determines whether this new DDG is for internal use only or if you’d like to be able to email it from the outside world. I’m usually asked to enable external senders because HR and Marketing departments share this DDG with external entities like 401k providers or marketing consultants. Keep in mind that you can always take advantage of Message Approval to keep a tight leash on this group’s use.

On the email addresses tab you can add aliases, change the primary alias, and remove aliases. As you can see I never changed my default domain so I need to change my primary alias to @Get-MSOL.com, something I could not have done when I originally created the group.

Maybe you’ve been cheated on, lied to, or otherwise deceived before and now you simply cannot trust this new-fangled DDG. Suppose you want to see who would be in the DDG without spamming all your colleagues, enter PowerShell. After Connecting PowerShell to Your Tenant you can run the command below (substituting in the name of your DDG) to list all the members that currently fit the criteria of the DDG as this moment in time. This ability is very important as you dive into custom filter rules for other DDGs.

$DDG = Get-DynamicDistributionGroup "_All Mail Users"

Get-Recipient -RecipientPreviewFilter $DDG.RecipientFilter

There you have it, a simple way to eliminate the need to maintain a global distribution group. If you ever want to get creative then I would encourage you to look through the distribution groups that you maintain and see if any could be converted into a DDG based on the attributes available in the rules section of the DDG creation dialog. You may never get another “Please add Suzy to the accounting mail group” email again.

Hate mail, racist tirades, topic suggestions, Obama jokes… send them all to me using the contact form to the right or nate@get-msol.com. If you want to share with the whole class use the comment section below.

#office365101 #powershell #o365 #exchangeonline #eac #office365

Featured Posts
Recent Posts
Search By Tags
No tags yet.