Requirement: Create New Office 365 Group using PowerShell
How to Create an Office 365 Group in the Admin Center?
Microsoft 365 Groups is a service that enables teams to work together by establishing a single identity and a single set of permissions across Microsoft 365 apps, including Outlook, SharePoint, OneNote, etc. You can create Office 365 groups through Microsoft 365 admin center as an admin.
- Log in to the Microsoft 365 Admin Center site: https://admin.microsoft.com
- Expand Groups and Click on Groups in the left navigation.
- Click on “Add a Group” >> Select “Office 365” under Type.
- Provide a name for the group and a unique email address for the group. Specify the privacy type for the Office 365 Group.
- Click on the “Select Owner” button and choose the owner to manage the group
- Click on “Add” to start creating the Office 365 group.
Once we’ve created a group, all related resources such as Shared mailbox, Calendar, SharePoint Site, etc., get provisioned automatically. Let’s see how to create an Office 365 group via PowerShell.
How to Create Office 365 Group using PowerShell?
Creating an Office 365 group through PowerShell allows you to have more control over the Group properties. To create an Office 365 Group, first, you need to establish a remote session to Exchange Online and then use the New-UnifiedGroup cmdlet to create an Office 365 Group with PowerShell.
Open Windows PowerShell and run the following script:
#Get Credentials to connect $Credential = Get-Credential #Connect to Exchange Online Connect-ExchangeOnline -Credential $Credential -ShowBanner:$False #Create New Office 365 Group New-UnifiedGroup -DisplayName "Consumers Group" -Alias "0365Group-consumers" ` -EmailAddresses "[email protected]" -AccessType Private #Disconnect Exchange Online Disconnect-ExchangeOnline -Confirm:$False
This creates a new private group called “Consumers Group” with an email address of “[email protected]”
Parameters used in this cmdlet are self-explanatory. They define properties of the group:
- DisplayName: The Display name of the group, is the minimum parameter to create a group.
- Alias: Exchange alias for the group. If you don’t supply the value for this parameter, it will be generated.
- EmailAddresses: The e-mail address of the Group.
- AccessType: Public or Private.
Numerous other parameters allow you to customize things even further, which are not available in UI!
Create New Office 365 Group using Azure AD PowerShell Module:
You can create a new group in Office 365 using the Azure Active Directory module as well. Here is an example:
#Connect to Azure AD Connect-AzureAD #Create new Office 365 group New-AzureADMSGroup -DisplayName "Accounts Group" -MailNickname "Accounts" -GroupTypes "Unified" -Description "Office 365 Group for Accounts Departmnet" -MailEnabled $True -SecurityEnabled $True
When the “Connect-AzureAD” cmdlet prompts for credentials, Enter your Office 365 Admin account!