SOLVED

Unable to restrict Microsoft 365 Groups In Teams

%3CLINGO-SUB%20id%3D%22lingo-sub-2626266%22%20slang%3D%22en-US%22%3EUnable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2626266%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20client%E2%80%99s%20requirement%20I%20had%20%3CSTRONG%3Eto%20restrict%20M365%20groups%3C%2FSTRONG%3E%20and%20only%20selected%20users%20can%20create%20Teams.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EI%20have%20followed%20the%20Microsoft%E2%80%99s%20step%20to%20restrict%20via%20PowerShell%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoft-365%2Fsolutions%2Fmanage-creation-of-groups%3Fview%3Do365-worldwide%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EManage%20who%20can%20create%20Microsoft%20365%20Groups%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_0-1628490422826.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301675iF260F54B6739EF1B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ArohShukla_0-1628490422826.png%22%20alt%3D%22ArohShukla_0-1628490422826.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24GroupName%20%3D%20%22%3CGROUPNAME%3E%22%0A%24AllowGroupCreation%20%3D%20%24False%0A%0AConnect-AzureAD%0A%0A%24settingsObjectID%20%3D%20(Get-AzureADDirectorySetting%20%7C%20Where-object%20-Property%20Displayname%20-Value%20%22Group.Unified%22%20-EQ).id%0Aif(!%24settingsObjectID)%0A%7B%0A%20%20%20%20%24template%20%3D%20Get-AzureADDirectorySettingTemplate%20%7C%20Where-object%20%7B%24_.displayname%20-eq%20%22group.unified%22%7D%0A%20%20%20%20%24settingsCopy%20%3D%20%24template.CreateDirectorySetting()%0A%20%20%20%20New-AzureADDirectorySetting%20-DirectorySetting%20%24settingsCopy%0A%20%20%20%20%24settingsObjectID%20%3D%20(Get-AzureADDirectorySetting%20%7C%20Where-object%20-Property%20Displayname%20-Value%20%22Group.Unified%22%20-EQ).id%0A%7D%0A%0A%24settingsCopy%20%3D%20Get-AzureADDirectorySetting%20-Id%20%24settingsObjectID%0A%24settingsCopy%5B%22EnableGroupCreation%22%5D%20%3D%20%24AllowGroupCreation%0A%0Aif(%24GroupName)%0A%7B%0A%20%20%24settingsCopy%5B%22GroupCreationAllowedGroupId%22%5D%20%3D%20(Get-AzureADGroup%20-SearchString%20%24GroupName).objectid%0A%7D%0A%20else%20%7B%0A%24settingsCopy%5B%22GroupCreationAllowedGroupId%22%5D%20%3D%20%24GroupName%0A%7D%0ASet-AzureADDirectorySetting%20-Id%20%24settingsObjectID%20-DirectorySetting%20%24settingsCopy%0A%0A(Get-AzureADDirectorySetting%20-Id%20%24settingsObjectID).Values%E2%80%8B%3C%2FGROUPNAME%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EI%20have%20created%20a%20Security%20%26nbsp%3Bgroup%20called%20as%20%3CSTRONG%3EOffice%20365%20Group%20Creators%3C%2FSTRONG%3E%20and%20I%20added%20my%20name%20to%20test%20it.%20%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_1-1628490422843.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301676i6B92FC6173E7BB25%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ArohShukla_1-1628490422843.png%22%20alt%3D%22ArohShukla_1-1628490422843.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EI%20am%20also%20%3CSTRONG%3EGlobal%20Admin%3C%2FSTRONG%3E%20for%20this%20tenant.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3EI%20ran%20the%20%3CSTRONG%3EPowerShell%3C%2FSTRONG%3E%20as%20per%20Microsoft%20steps%20as%20follows%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_2-1628490422867.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301677i230DA2D9DE0953BB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ArohShukla_2-1628490422867.png%22%20alt%3D%22ArohShukla_2-1628490422867.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3CLI%3EBut%20when%20I%20wait%20for%20%3CSTRONG%3E1%20hour%3C%2FSTRONG%3E%2C%20I%20myself%20%3CSTRONG%3E%3CU%3Ecant%20create%20new%20teams%3C%2FU%3E%3C%2FSTRONG%3E%20although%20I%20am%20in%20%3CSTRONG%3EOffice%20365%20Group%20Creators%3C%2FSTRONG%3E%20security%20group%20as%20follows%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_3-1628490422886.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301678i344A75B04D7732B1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ArohShukla_3-1628490422886.png%22%20alt%3D%22ArohShukla_3-1628490422886.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3EWhich%20step%20I%20am%20missing%20here%3F%20Please%20advise.%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F551905%22%20target%3D%22_blank%22%3E%40ChristianBergstrom%3C%2FA%3E%26nbsp%3B%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2626266%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdministrator%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHow-to%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIT%20Pro%20Training%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2626290%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2626290%22%20slang%3D%22en-US%22%3EYou%20are%20sure%20you%20added%20the%20group%20correctly%20at%20row%201%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2626592%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2626592%22%20slang%3D%22en-US%22%3E%3CP%3EWhat%20values%20are%20returned%20by%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24Values%20%3D%20Get-AzureADDirectorySetting%20%7C%20%3F%7B%24_.DisplayName%20-eq%20%22Group.Unified%22%7D%0A%24GroupId%20%3D%20%24Values.Values%20%7C%3F%7B%24_.Name%20-eq%20%22GroupCreationAllowedGroupId%22%20%7D%20%7C%20Select%20-ExpandProperty%20Value%0AWrite-Host%20(%22The%20name%20of%20the%20group%20defined%20by%20policy%20to%20control%20group%20creation%20is%20%7B0%7D%20and%20its%20object%20identifier%20is%20%7B1%7D%22%20-f%20(Get-AzureADGroup%20-ObjectId%20%24GroupId).DisplayName%2C%20%24GroupId)%0AGet-AzureADGroupMember%20-ObjectId%20%24GroupId%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20don't%20have%20a%20good%20group%20identifier%20in%20the%20policy%20settings%2C%20nothing%20will%20work...%3CBR%20%2F%3E%3CBR%20%2F%3E(from%20%3CA%20href%3D%22https%3A%2F%2Foffice365itpros.com%2F2021%2F08%2F09%2Fupdates-group-creation-settings-azure-ad-admin-center%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Foffice365itpros.com%2F2021%2F08%2F09%2Fupdates-group-creation-settings-azure-ad-admin-center%2F%3C%2FA%3E)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2626777%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2626777%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3B%20and%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EJust%20to%20safe%20side%2C%20I%20created%20a%20new%20security%20groups%20called%20%26nbsp%3B%3CSTRONG%3ERestrictM365Groups%20%3C%2FSTRONG%3E(no%20spaces%20in%20the%20name)%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_0-1628500834618.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301725iE9E15E88ED38A50A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ArohShukla_0-1628500834618.png%22%20alt%3D%22ArohShukla_0-1628500834618.png%22%20%2F%3E%3C%2FSPAN%3Eand%20added%20only%20my%20name%20in%20this%20group.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_1-1628500834635.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301727iDDDDE6670421845F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ArohShukla_1-1628500834635.png%22%20alt%3D%22ArohShukla_1-1628500834635.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%26nbsp%3B%3A%3CBR%20%2F%3E%3CBR%20%2F%3EI%20just%20checked%2C%20in%20the%20client%E2%80%99s%20tenant%2C%20%3CSTRONG%3ESecurity%20Groups%3C%2FSTRONG%3E%20is%20%3CSTRONG%3Eturned%20on%3C%2FSTRONG%3E%20but%20Microsoft%20365%20Groups%20is%20%3CSTRONG%3Eturned%20off%3C%2FSTRONG%3E%20at%20Azure%20Portal.%20%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_2-1628500834652.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301726i5E4E2CED4806CD7F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ArohShukla_2-1628500834652.png%22%20alt%3D%22ArohShukla_2-1628500834652.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CU%3E%3CSTRONG%3EQuestion%3A%3C%2FSTRONG%3E%3C%2FU%3E%20As%20I%20have%20%3CSTRONG%3Edisabled%20Microsoft%20365%20Groups%20for%20entire%20organization%3C%2FSTRONG%3E%2C%20turning%20off%20Microsoft%20365%20Groups%20looks%20good%20option.%20%3CSTRONG%3E%3CU%3EPlease%20advise%3C%2FU%3E%3C%2FSTRONG%3E%20if%20its%20correct.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3EWhen%20I%20ran%20your%20script%2C%20it%20did%20display%20the%20%3CSTRONG%3ERestrictM365Groups%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_3-1628500834657.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301728i0FEA57C10F8B484E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ArohShukla_3-1628500834657.png%22%20alt%3D%22ArohShukla_3-1628500834657.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3CLI%3ELogged%20in%20and%20logged%20out%20multiple%20times.%20But%20I%20still%20%3CSTRONG%3Ecan%E2%80%99t%20create%20new%20teams%3C%2FSTRONG%3E%20after%20%3CSTRONG%3E40%20mins.%20%3C%2FSTRONG%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_4-1628500834669.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301729iB739B8CF1D94FB9A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ArohShukla_4-1628500834669.png%22%20alt%3D%22ArohShukla_4-1628500834669.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%3CBR%20%2F%3EAny%20suggestions%20please.%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2626793%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2626793%22%20slang%3D%22en-US%22%3EOut%20of%20curiosity%3A%20Do%20you%20have%20Azure%20AD%20Premium%20licenses%20assigned%20to%20the%20users%20that%20belong%20to%20your%20security%20group%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2626857%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2626857%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20your%20reply%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3E%26nbsp%3BDoes%20M365%20Group%20Restriction%20require%20AAD%20P1%20license%3F%26nbsp%3B%20I%20guess%2C%20its%20only%20for%20Naming%2C%20Blocked%20and%20Group%20Expiration%2C%20isn't%20it%3F%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%26nbsp%3B..could%20you%20please%20advice%20on%20that%3F%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3EBut%20my%20account%20does%20has%26nbsp%3BAAD%20P1%20license.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_0-1628503495771.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301734iAECA19789F14B8F7%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22ArohShukla_0-1628503495771.png%22%20alt%3D%22ArohShukla_0-1628503495771.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%26nbsp%3B%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2626917%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2626917%22%20slang%3D%22en-US%22%3EGroup%20creation%20control%20requires%20Azure%20AD%20Premium%20P1%2C%20but%20as%20this%20requirement%20is%20not%20enforced%2C%20I%20don't%20think%20it%20is%20the%20problem.%20It's%20more%20likely%20the%20disablement%20of%20Microsoft%20365%20Groups%20for%20the%20tenant.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2627275%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20restrict%20Microsoft%20365%20Groups%20In%20Teams%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2627275%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20a%20million%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%26nbsp%3B%2C%20I%20guess%20I%20have%20to%20turn%20on%20Microsoft%20365%20Groups%20and%20it%20should%20resolve%20the%20problem%20...%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ArohShukla_0-1628512348283.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301762i1081BF3A2BCC305B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ArohShukla_0-1628512348283.png%22%20alt%3D%22ArohShukla_0-1628512348283.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

Hi All,

 

I have a client’s requirement I had to restrict M365 groups and only selected users can create Teams.

 

 

$GroupName = "<GroupName>"
$AllowGroupCreation = $False

Connect-AzureAD

$settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
if(!$settingsObjectID)
{
    $template = Get-AzureADDirectorySettingTemplate | Where-object {$_.displayname -eq "group.unified"}
    $settingsCopy = $template.CreateDirectorySetting()
    New-AzureADDirectorySetting -DirectorySetting $settingsCopy
    $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
}

$settingsCopy = Get-AzureADDirectorySetting -Id $settingsObjectID
$settingsCopy["EnableGroupCreation"] = $AllowGroupCreation

if($GroupName)
{
  $settingsCopy["GroupCreationAllowedGroupId"] = (Get-AzureADGroup -SearchString $GroupName).objectid
}
 else {
$settingsCopy["GroupCreationAllowedGroupId"] = $GroupName
}
Set-AzureADDirectorySetting -Id $settingsObjectID -DirectorySetting $settingsCopy

(Get-AzureADDirectorySetting -Id $settingsObjectID).Values​



 

  • I have created a Security  group called as Office 365 Group Creators and I added my name to test it.  

    ArohShukla_1-1628490422843.png

     



    I am also Global Admin for this tenant.

  • I ran the PowerShell as per Microsoft steps as follows:
    ArohShukla_2-1628490422867.png

     

  • But when I wait for 1 hour, I myself cant create new teams although I am in Office 365 Group Creators security group as follows:

    ArohShukla_3-1628490422886.png

     



  • Which step I am missing here? Please advise.
     

  • @Tony Redmond @Juan Carlos González Martín  @ChristianBergstrom 
18 Replies
You are sure you added the group correctly at row 1?

What values are returned by:

$Values = Get-AzureADDirectorySetting | ?{$_.DisplayName -eq "Group.Unified"}
$GroupId = $Values.Values |?{$_.Name -eq "GroupCreationAllowedGroupId" } | Select -ExpandProperty Value
Write-Host ("The name of the group defined by policy to control group creation is {0} and its object identifier is {1}" -f (Get-AzureADGroup -ObjectId $GroupId).DisplayName, $GroupId)
Get-AzureADGroupMember -ObjectId $GroupId



If you don't have a good group identifier in the policy settings, nothing will work...

(from https://office365itpros.com/2021/08/09/updates-group-creation-settings-azure-ad-admin-center/)

Thanks  @adam deltinger  and @Tony Redmond

 

  • Just to safe side, I created a new security groups called  RestrictM365Groups (no spaces in the name)

    ArohShukla_0-1628500834618.pngand added only my name in this group.

    ArohShukla_1-1628500834635.png

     

  • @Tony Redmond :

    I just checked, in the client’s tenant, Security Groups is turned on but Microsoft 365 Groups is turned off at Azure Portal.  

    ArohShukla_2-1628500834652.png

     



    Question: As I have disabled Microsoft 365 Groups for entire organization, turning off Microsoft 365 Groups looks good option. Please advise if its correct.

  • When I ran your script, it did display the RestrictM365Groups

    ArohShukla_3-1628500834657.png

     

  • Logged in and logged out multiple times. But I still can’t create new teams after 40 mins.  

    ArohShukla_4-1628500834669.png


    Any suggestions please. 

Out of curiosity: Do you have Azure AD Premium licenses assigned to the users that belong to your security group?

Thanks for your reply @Juan Carlos González Martín

 

  •  Does M365 Group Restriction require AAD P1 license?  I guess, its only for Naming, Blocked and Group Expiration, isn't it? @Tony Redmond ..could you please advice on that? 

  • But my account does has AAD P1 license. 

    ArohShukla_0-1628503495771.png

     


     
Group creation control requires Azure AD Premium P1, but as this requirement is not enforced, I don't think it is the problem. It's more likely the disablement of Microsoft 365 Groups for the tenant.

Thanks a million @Tony Redmond , I guess I have to turn on Microsoft 365 Groups and it should resolve the problem ...

ArohShukla_0-1628512348283.png

 

@Juan Carlos González Martín  @adam deltinger   @Tony Redmond 

  • Testing it but I cant create Teams. Steps I followed:   

    1)  M365 groups is  Enabled at the M365 Admin Center.
    ArohShukla_0-1628516955941.png

     



  • At Azure Portal, Microsoft 365 Groups is also turned on.

    ArohShukla_1-1628516955957.png

     



  • PowerShell has been executed with my account which has AAD P1 license

    ArohShukla_2-1628516955970.png

     



  • Still with my account which is in RestrictedM365Group security group, I cant create Team

    ArohShukla_3-1628516955982.png

     




Any suggestions please? 

Can you create a team using the Microsoft 365 admin center?

Or a new group by running the New-UnifiedGroup cmdlet?
Wonder if this is a cause of delay due to propagation. But if I recall correctly it goes pretty quick. Have you done a log out and logged back in Teams? Can you create a planner plan from planner directly etc?

Adam

@adam deltinger @Juan Carlos González Martín and @Tony Redmond 

  • I waited for 1 day.

  • I noticed that Microsoft 365 Groups toggled automatically to turned off.
    :facepalm:


  • I turned it on
    ArohShukla_0-1628659370002.png
    and ran the script again.

    ArohShukla_1-1628659370017.png

     

  • RestrictM365Groups security group has only my account and no one else.

  • Waited for 40 mins.

  • Using Teams App, I can create new teams
    :hearteyes:

    ArohShukla_2-1628659370023.png

     

  • And other users cannot create new Teams.
    :stareyes:
    ArohShukla_3-1628659370038.png

     

  • Yipee!!:happyface:

  • @Tony Redmond

    We have to turn on both Security Groups and Microsoft 365 Groups to be turned on? Is it?

    ArohShukla_5-1628659683292.png

     


     



I don’t think these 2 settings are relevant for this matter.

@adam deltinger 

You are correct. 

 

 

after around 1 hour, I found that normal users, who are not  RestrictM365Groups security group, in can create teams  

ArohShukla_0-1628670076726.png

looks Groups settings is not impacting this setting

ArohShukla_1-1628670303729.png


Looks I am back to square one.
Any advice experts?

 

@Aroh Shukla Given that you appear to be following the guidelines in https://docs.microsoft.com/en-us/microsoft-365/solutions/manage-creation-of-groups?view=o365-worldwi... why don't you log a call with Microsoft support and have them look at your tenant? No one here (except you) can sign into your tenant to check the settings, but Microsoft support can... and an extra set of eyes is often useful when looking for something small that's getting in the way.

best response confirmed by Aroh Shukla (Frequent Contributor)
Solution

Hi @Tony Redmond@adam deltinger  and @Juan Carlos González Martín 

 

@Tony Redmond I did contact MS Support and issue is resolved.  Here is summary what happened: 

 

  1. In Microsoft call, they were added a different user (Alex) to the group as a Member and Owner as well as. Removed my account (Aroh)  from the RestrictM365Groups

  2.   After re-running the script

 

$GroupName = "RestrictM365Groups"
$AllowGroupCreation = $False

Connect-AzureAD

$settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
if(!$settingsObjectID)
{
    $template = Get-AzureADDirectorySettingTemplate | Where-object {$_.displayname -eq "group.unified"}
    $settingsCopy = $template.CreateDirectorySetting()
    New-AzureADDirectorySetting -DirectorySetting $settingsCopy
    $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
}

$settingsCopy = Get-AzureADDirectorySetting -Id $settingsObjectID
$settingsCopy["EnableGroupCreation"] = $AllowGroupCreation

if($GroupName)
{
  $settingsCopy["GroupCreationAllowedGroupId"] = (Get-AzureADGroup -SearchString $GroupName).objectid
}
 else {
$settingsCopy["GroupCreationAllowedGroupId"] = $GroupName
}
Set-AzureADDirectorySetting -Id $settingsObjectID -DirectorySetting $settingsCopy

(Get-AzureADDirectorySetting -Id $settingsObjectID).Values


$Values = Get-AzureADDirectorySetting | ?{$_.DisplayName -eq "Group.Unified"}
$GroupId = $Values.Values |?{$_.Name -eq "GroupCreationAllowedGroupId" } | Select -ExpandProperty Value
Write-Host ("The name of the group defined by policy to control group creation is {0} and its object identifier is {1}" -f (Get-AzureADGroup -ObjectId $GroupId).DisplayName, $GroupId)
Get-AzureADGroupMember -ObjectId $GroupId​


and waiting a moment, the settings seemed to be working correctly.

 

  • The issue was, that I was owner of the group but there was no member for the RestrictM365Groups security group

  • After adding my name in both in Owner and Member  
    ArohShukla_6-1628765370584.png
  • I can create teams with my account
    ArohShukla_11-1628765451487.png

     


     
  •  Other users cannot create Teams
    ArohShukla_12-1628765511425.png

    ArohShukla_13-1628765536989.png
  • The Microsoft 365 Groups settings at Azure portal has to be turned off.

    ArohShukla_14-1628765613872.png

     

    Thanks a lot for helping and providing your help! 
The joys of Groups Memberships that are even difficult to remember for Microsoft itself
This makes sense. It's a common mistake inside Microsoft 365 to assume that just because you own a group, you have the rights enjoyed by the membership of the group (access to a Planner plan is another example). When you think about it, a clear demarcation exists because group ownership and membership for a good reason (owners take care of management, members do what they need to do with resources they can access through their membership). Apps like Teams read the Azure AD policy and find that group creation control is enabled and a group id exists. The app reads the membership list and applies the block.

Maybe the Office 365 for IT Pros eBook would help you navigate some of the challenges of tenant management. It's available at https://o365itpros.gumroad.com/l/O365IT (gratuitous ad)