Microsoft Group migration Challenge in Tenant-to-Tenant

Recently I was doing a Tenant-to-Tenant migration where source Microsoft 365 Tenant have over 300 Microsoft 365 Group associated sites and customer need all those groups to be migrated along with members and sites. SharePoint sites data can be migrated using migration tool but none of the migration tools allows to create Microsoft 365 groups.

Google Groups migration Challenge to Microsoft 365

Similar scenario we faced in another migration from Google Suite to Microsoft 365 where we have to migrate all the Google groups and their members which are not possible using any migration tool.


We can create the Microsoft 365 groups using Microsoft 365 Admin center and add users to it but that would be very manual process and not handy when you need to create multiple groups. I am sharing a PowerShell script which will be helpful for you create Microsoft 365 groups and add group owners and members directly.

You can place all the group name details in a scv file wit below parameters which we would need while creating the groups:

  • GroupName (name of the group)
  • GroupAlias (alias of the group, will be use as group email alias and associated SharePoint site url)
  • Owners (Comma separated emails)
  • Members (Comma separated emails)
  • Privacy (pass Private or public parameters)

I have used Pnp and Graph PowerShell modules for the script. Use below script to create Microsoft 365 Groups in a single go:

Connect-PnPOnline -Url "" -UseWebLogin 

Connect-PnPOnline –Graph 
$path = "D:\\createGroups.csv"

function StartGroupCreation()
$AllGroups = Import-Csv -Path $path 

 foreach ($group in $AllGroups) {

    $Groupname = ''
    $Owners = ''
    $Members = ''
    $Groupalias = ''
    $Description = ''
    $Groupprivacy = ''
    $Groupname = $group.Name
    $Owners =  $group.Owners
    $Members = $group.Members
    $Groupalias = $group.Email
    $Groupprivacy = $group.Privacy
    CreateMicrosoft365Group -Groupname $Groupname -Groupalias $Groupalias -Owners $Owners -Members $Members -Groupprivacy $Groupprivacy

function CreateMicrosoft365Group($Groupname, $Groupalias, $Owners, $Members,  $Groupprivacy)
    $Groupalias = $Groupalias
    $arrOwners = $Owners.split(',')
    $arrMembers = $Members.split(',')
    $NewGroup = ''
    Write-Host 'Started creation ofM365 Group: ' + $Groupname
    if ($Groupprivacy -eq 'Private')
        $NewGroup = New-PnPMicrosoft365Group -DisplayName $Groupname -MailNickname $Groupalias -Description $Groupname -Owners $arrOwners -Members $arrMembers -IsPrivate
        $NewGroup = New-PnPMicrosoft365Group -DisplayName $Groupname -MailNickname $Groupalias -Description $Groupname -Owners $arrOwners -Members $arrMembers 
     Write-Host Write-Host 'Created creation ofM365 Group: ' + $Groupname -ForegroundColor Green    

From above script, call StartGroupCreation() function after compilation and this will start creation of script based on details added in CSV file.

Adnan, a distinguished professional, boasts an impressive track record as a Microsoft MVP, having achieved this prestigious recognition for the eighth consecutive year since 2015. With an extensive career spanning over 18 years, Adnan has honed his expertise in various domains, notably excelling in SharePoint, Microsoft 365, Microsoft Teams, the .Net Platform, and Microsoft BI. Presently, he holds the esteemed position of Senior Microsoft Consultant at Olive + Goose. Notably, Adnan served as the MCT Regional Lead for the Pakistan Chapter from 2012 to 2017, showcasing his leadership and commitment to fostering growth within the tech community. His journey in the realm of SharePoint spans 14 years, during which he has undertaken diverse projects involving both intranet and internet solutions for both private and government sectors. His impact has transcended geographical boundaries, leaving a mark on projects in the United States and the Gulf region, often collaborating with Fortune 500 companies. Beyond his roles, Adnan is a dedicated educator, sharing his insights and knowledge as a trainer. He also passionately advocates for technology, frequently engaging with the community through speaking engagements in various forums. His multifaceted contributions exemplify his dedication to the tech field and his role in driving its evolution.

Leave a Reply