{"id":364,"date":"2015-11-20T10:51:08","date_gmt":"2015-11-20T10:51:08","guid":{"rendered":"https:\/\/www.sharepoint13.org\/?p=364"},"modified":"2015-11-20T13:26:39","modified_gmt":"2015-11-20T13:26:39","slug":"office365-useradmin-with-powershell-part-3-add-securitygroups-to-sitegroups","status":"publish","type":"post","link":"https:\/\/www.sharepoint13.org\/?p=364","title":{"rendered":"Office365 Useradmin with PowerShell &ndash;Part 3: Add DistributionGroups to SiteGroups"},"content":{"rendered":"<p>For easier admin of SiteGroups I like to nest&#160; Security enabled Mail DistributionGroups from Exchange Online into SP SiteGroups. Sadly we cannot add UnifiedGroups aka \u201cOffice365 Groups\u201d. <\/p>\n<p>First connect to <a href=\"https:\/\/technet.microsoft.com\/nb-no\/library\/jj984289.aspx\" target=\"_blank\">Exchange Online with PowerShell<\/a> and run     <br \/><strong><em>PS&gt;Get-DistributionGroup<\/em><\/strong>&#160; Only the SecurityEnabled DGroups are avilable to add to a SP SiteGroup     <br \/><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image14.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb15.png\" width=\"244\" height=\"41\" \/><\/a>    <br \/>Here\u2019s the PS script I used to create the DonkeyKong DistributionGroup:    <br \/><strong><em>PS&gt;New-Distributiongroup -name &quot;Donkey Kongs&quot; -alias &quot;DonkeyKongs&quot; -type &quot;security&quot; -primarysmtpaddress &quot;donkeykongs@vaerpn.com&quot; \u2013members admin@vaerpn.com,randy.williams@vaerpn.com,joachim.gjertsen@vaerpn.com<\/em><\/strong><\/p>\n<p>The trick to add this DistGroup to a SP SiteGroup is to use \u201c-primarysmtpaddress\u201d as \u2013LoginName like this:   <br \/><strong><em>PS&gt;Add-SPOUser \u2013Group \u201cAdministration Visitors\u201d \u2013LoginName donkeykongs@vaerpn.com&#160; -Site https:\/\/vaerpn.sharepoint.com\/sites\/github<\/em><\/strong><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image15.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb16.png\" width=\"244\" height=\"25\" \/><\/a>    <br \/>(See also <a href=\"https:\/\/www.sharepoint13.org\/?p=361\" target=\"_blank\">Part2<\/a> \u2013 Add Users to SiteGroups, I like to use seperate .csv files)<\/p>\n<p>Run the <em><strong>PS&gt;Get-SPOSiteGroup -Site <\/strong><strong>https:\/\/vaerpn.sharepoint.com\/sites\/github<\/strong><\/em><strong><em>        <br \/><\/em><\/strong><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image16.png\"><strong><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb17.png\" width=\"244\" height=\"31\" \/><\/strong><\/a>    <br \/>Notice that the SecurityEnabled Distribution lists only displaying long UID. But in SharePoint it displays friendly.    <br \/><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image17.png\"><strong><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb18.png\" width=\"244\" height=\"97\" \/><\/strong><\/a><\/p>\n<p>&#8211; Offcourse you can add \u201cnormal\u201d Microsoft Online Security Groups, in Cloud or from AD Sync \u2013 but these are not possible to mail enable,   <br \/>Run <strong><em>PS&gt;Get-MsolGroup<\/em>      <br \/><\/strong><a href=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image18.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/www.sharepoint13.org\/wp-content\/uploads\/2015\/11\/image_thumb19.png\" width=\"244\" height=\"109\" \/><\/a><\/p>\n<p>References:<\/p>\n<p><a href=\"https:\/\/technet.microsoft.com\/nb-no\/library\/jj984289.aspx\" target=\"_blank\">Using PS with Exchange Online<\/a><\/p>\n<p><a href=\"https:\/\/technet.microsoft.com\/nb-no\/library\/jj200780.aspx\" target=\"_blank\">Exchange Online cmdlets<\/a><\/p>\n<p><a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/321d532e-407d-4e29-a00a-8afbe23008dd#BKMK_ManageGroups\">Manage Azure AD Using PowerShell<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For easier admin of SiteGroups I like to nest&#160; Security enabled Mail DistributionGroups from Exchange Online into SP SiteGroups. Sadly we cannot add UnifiedGroups aka \u201cOffice365 Groups\u201d. First connect to Exchange Online with PowerShell and<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[17,11],"class_list":["post-364","post","type-post","status-publish","format-standard","hentry","category-office365","tag-office-365","tag-powershell"],"_links":{"self":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts\/364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=364"}],"version-history":[{"count":6,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts\/364\/revisions"}],"predecessor-version":[{"id":380,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=\/wp\/v2\/posts\/364\/revisions\/380"}],"wp:attachment":[{"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sharepoint13.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}