Nesting Groups in Office 365
Nesting Groups has been a bit of a pain in Office 365 for a while now but there's apparently a few answers (and some updates on the way).
Here's a PowerShell method.
The SetupTo start with, we're going to create a group in Office365 Admin. It should be a mail enabled security group.
In our example the group will be called;
and it will have an email address of MotherGroup@mydomain.com
(obviously the domain will be different at your location).
For the purposes of this exercise, you'll also want to create several groups to be nested.
These are distribution groups and their names and emails for the purposes of our demonstration will be;
GRP BabyGroup1 email@example.com
GRP BabyGroup2 firstname.lastname@example.org
GRP BabyGroup3 email@example.com
GRP BabyGroup4 firstname.lastname@example.org
The PowerShell CommandsAs usual, you'll want to run PowerShell in Administrator Mode.
Press Y and Enter.
$UserCredential = Get-Credential
You'll be prompted to logon with your user name and password. If you have multi-factor authentication enabled, you'll probably have a few extra hoops to jump through here.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
This creates the session
This activates the session.
The next command is specific to your group. It looks like this (boldfaced parts will be replaced).
If you're following our example, the commands would be as follows;
Add-DistributionGroupMember -Identity MotherGroup@mydomain.com -Member email@example.com
Add-DistributionGroupMember -Identity MotherGroup@mydomain.com -Member firstname.lastname@example.org
Add-DistributionGroupMember -Identity MotherGroup@mydomain.com -Member email@example.com
Add-DistributionGroupMember -Identity MotherGroup@mydomain.com -Member firstname.lastname@example.org
As usual, because we're neat people, we remove our session before exiting...
If you go into the Office 365 Admin console, you should be able to find your group, now with the nested subgroups below it. It's a painful process but it works.