How to restrict Group and Teams Creation with MSGraph
You're right! Since AzureAD and MSOnline modules are deprecated, you need to use the Microsoft Graph PowerShell SDK to retrieve the group ID. Solution Using Microsoft Graph PowerShell You must have a M365 group created first and define the membership : Allowed Group Creators . 1. Install and Connect to Microsoft Graph PowerShell If you haven't installed it yet, run: Install-Module Microsoft.Graph -Scope CurrentUser Then, sign in with an Admin account : Connect-MgGraph -Scopes "Group.Read.All", "Directory.ReadWrite.All" If prompted, grant admin consent for the required permissions. 2. Get the Security Group ID Since Get-AzureADGroup no longer works, use this instead: Get-MgGroup -Filter "displayName eq 'Allowed Group Creators'" Copy the Id from the output (this is the Object ID needed for the restriction). 3. Apply Group Creation Restriction Run the following PowerShell commands to modify the Microsoft 365 Group Crea...