How to add a security group in O365

This article talks about on how to add a security group in O365

Security group in O365

In O365, Security groups give people access to resources such as ‎SharePoint‎ sites. They can also include devices, for use with mobile device management. 

steps to add a security group in O365

Open O365 admin center: https://admin.microsoft.com/

Navigate to Teams & groups –> Active teams & groups –> security groups –> add a security group

fill in all details ( see below )

Review and finish it

Done

You can manage it from here

PowerShell script for above manual task

# Install Microsoft Graph module if not already installed
# Install-Module Microsoft.Graph -Scope CurrentUser

# Import the module
Import-Module Microsoft.Graph

# Connect to Microsoft Graph with the required permissions
Connect-MgGraph -Scopes "Group.ReadWrite.All"

# Create a new security group
$group = New-MgGroup -DisplayName "MySecurityGroup" `
                     -MailEnabled:$false `
                     -MailNickname "MySecurityGroup" `
                     -SecurityEnabled:$true `
                     -Description "This is a security group created via PowerShell"

# Output the group details
Write-Output "Security Group Created Successfully!"
Write-Output "Group ID: $($group.Id)"
Write-Output "Group Name: $($group.DisplayName)"

security group vs mail-enabled security group

A security group is primarily for controlling access to network resources, while a mail-enabled security group adds the capability to send and receive emails to all members of the group, functioning as a hybrid of a security group and a distribution list. Mail-enabled security groups can also be added to Microsoft 365 Teams, but cannot be dynamically managed through Microsoft Entra ID and cannot contain devices as members.

Conclusion:

Post reading above article, reader will be able to add a security group in O365 successfully.

You can also read this article https://microbrother.com/how-to-add-a-distribution-list-in-o365/ to add a distribution list in O365.

Thank you ☺️

Also Read  How to assign roles to user in O365

Leave a Comment