For easier admin of SiteGroups I like to nest  Security enabled Mail DistributionGroups from Exchange Online into SP SiteGroups. Sadly we cannot add UnifiedGroups aka “Office365 Groups”.

First connect to Exchange Online with PowerShell and run
PS>Get-DistributionGroup  Only the SecurityEnabled DGroups are avilable to add to a SP SiteGroup
image
Here’s the PS script I used to create the DonkeyKong DistributionGroup:
PS>New-Distributiongroup -name "Donkey Kongs" -alias "DonkeyKongs" -type "security" -primarysmtpaddress "donkeykongs@vaerpn.com" –members admin@vaerpn.com,randy.williams@vaerpn.com,joachim.gjertsen@vaerpn.com

The trick to add this DistGroup to a SP SiteGroup is to use “-primarysmtpaddress” as –LoginName like this:
PS>Add-SPOUser –Group “Administration Visitors” –LoginName donkeykongs@vaerpn.com  -Site https://vaerpn.sharepoint.com/sites/githubimage
(See also Part2 – Add Users to SiteGroups, I like to use seperate .csv files)

Run the PS>Get-SPOSiteGroup -Site https://vaerpn.sharepoint.com/sites/github
image
Notice that the SecurityEnabled Distribution lists only displaying long UID. But in SharePoint it displays friendly.
image

– Offcourse you can add “normal” Microsoft Online Security Groups, in Cloud or from AD Sync – but these are not possible to mail enable,
Run PS>Get-MsolGroup
image

References:

Using PS with Exchange Online

Exchange Online cmdlets

Manage Azure AD Using PowerShell

by Thorbjørn Værp on Nov 20, 2015 at 10:51 AM

tagged:

Leave a Reply