technet:msgraph:creategroup
Microsoft 365 Group and Microsoft Graph
Creating a New Microsoft 365 Group with the Microsoft PowerShell Graph SDK
Connect-ExchangeOnline Connect-IPPSSession DisplayName ImmutableId ----------- ----------- Non-business use a49e1277-93db-4a2f-8105-43c5196b4fef General Access e42fd42e-7240-4df0-9d8f-d14658bcf7ce Guest Access c29e68f9-bc4f-413b-a741-6db8e38ad1c6 Limited Access d6cfd185-f31c-4508-ae40-229ff18a9919 Confidential Access c99e52c6-f5ff-4050-9313-ca6a3a35710f Connect-MgGraph -Scopes Group.ReadWrite.All, GroupMember.ReadWrite.All $SensitivityLabelId = "d6cfd185-f31c-4508-ae40-229ff18a9919" $NewGroupParams = @{ "displayName" = "Microsoft Graph PowerShell SDK" "mailNickname"= "Microsoft.Graph.PowerShell.SDK" "description" = "People who like to discuss how to use the Microsoft Graph PowerShell SDK" "owners@odata.bind" = @( "https://graph.microsoft.com/v1.0/me" ) "groupTypes" = @( "Unified" ) "mailEnabled" = "true" "securityEnabled" = "true" "assignedLabels" = @( @{"LabelId"=$SensitivityLabelId} ) } $Group = New-MgGroup -BodyParameter $NewGroupParams $Uri= "https://graph.microsoft.com/v1.0/groups" $Group = Invoke-MgGraphRequest -Method Post -Uri $Uri -Body $NewGroupParams $NewTeamParams = @{ "template@odata.bind"="https://graph.microsoft.com/v1.0/teamsTemplates('standard')" "group@odata.bind"="https://graph.microsoft.com/v1.0/groups('$($Group.Id)')" } New-MgTeam -BodyParameter $NewTeamParams $NewTeamParams = @{ "template@odata.bind"="https://graph.microsoft.com/v1.0/teamsTemplates('standard')" "group@odata.bind"="https://graph.microsoft.com/v1.0/groups('a771ae9d-6a93-4ccb-bbd0-dcfa55138f2f')" } $NewTeamParams = $NewTeamParams | Convertto-Json $Uri = "https://graph.microsoft.com/v1.0/teams" Invoke-MgGraphRequest -Uri $Uri -Method Post -Body $NewTeamParams
technet/msgraph/creategroup.txt · Last modified: 2023/06/14 09:43 by A User Not Logged in