Tutorial on how to migrate G Suite to O365 with API instead of using IMAP which need to know credential for individual users’ mailbox
Google Service Account
Sign in to Google Cloud Platform with the administrator credential for the Trial Account provisioned
Go to Dashboard – Down Arrow – New Project to create a new project
Enter a Project Name called GSuiteToO365 and click CREATE
Expand the Left Top Menu and go to IAM & Admin – Service Accounts – Create Service Account
Assign a Name for Google Service Account, like G2O365 with description and click CREATE to continue
Click Continue
Click DONE
Create a Private Key for Google Service Account
Select JSON and click CREATE
Save the Private Key (JSON file) as it is required when we create the mailbox migration batch in Office 365 later
Double click on the Google Service Accounts and copy the value of Unique ID. Click on SHOW DOMAIN-WIDE DELEGATION
Click EDIT to ENABLE G Suite Domain-wide Delegation. Enter a Name in Product Name for the consent screen and click SAVE
Enable Domain-Wide Delegation – Allows this service account to be authorized to access all users’ data on a G Suite domain without manual authorization on their parts
Enable API Usage for Gmail, Google Calendar & Contacts
Go to APIs & Services – Library
Search for Gmail API, Google Calendar API & Contacts API
Click ENABLE to enable the API Usage for Gmail API, Google Calendar API & Contacts API
Grant Access to Google Service Account
Sign in to G Suite Admin Page and go to Security – App Access Control. Click MANAGE DOMAIN-WIDE DELEGATION
Create a new Client ID with
- Client ID = Unique ID of Google Service Account created
- OAuth Scopes = https://mail.google.com/,https://www.googleapis.com/auth/calendar,https://www.google.com/m8/feeds/,https://www.googleapis.com/auth/gmail.settings.sharing
Click AUTHORISE to add the new Client ID
Verify the API Client is created successfully
Connect to Office 365 with PowerShell to test connectivity between G Suite and Microsoft 365 with JSON file and Admin Account for G Suite
Test-MigrationServerAvailability -Gmail -ServiceAccountKeyFileData $([System.IO.File]::ReadAllBytes("C:\\temp\\gsuitetoo365-281817-28cc5c8d308a.json")) -EmailAddress [email protected]
RunspaceId : 294a8e67-a33f-499f-b780-5e320670aa63
Result : Success
Message :
SupportsCutover : False
ErrorDetail :
TestedEndpoint : [email protected]
IsValid : True
Identity :
ObjectState : New
Create a New Migration EndPoint called GmailEndPoint
New-MigrationEndpoint -Gmail -ServiceAccountKeyFileData $([System.IO.File]::ReadAllBytes("C:\\temp\\gsuitetoo365-281817-28cc5c8d308a.json")) `
-EmailAddress [email protected] -Name GmailEndPoint
Migrate G Suite to O365 with API – Cut Over Migration
Export Users from G Suite and Import to Office 365
Export all users & groups from Google G Suite by referring to Manage Google G Suite with PowerShell
Provision Users & Groups in Office 365 from the exported CSV file
Migration Batch to Migrate Users from G Suite to Office 365
Prepare a CSV file contain user’s email address as below and save it as C:\temp\MigrateUsers.csv
EmailAddress
[email protected]
[email protected]
Create a new Migration Bath to migrate uat1 & uat2 from G Suite to Office 365
New-MigrationBatch -SourceEndpoint GmailEndpoint -Name Batch-20200723 -CSVData $([System.IO.File]::ReadAllBytes("C:\temp\MigrateUsers.csv")) `
-TargetDeliveryDomain "M365x510625.onmicrosoft.com"
Start-MigrationBatch -Identity "Batch-20200723"
It might take some time to complete the sync depend on the mailbox size and it will synchronize every 24 hours
Get-MigrationBatch
Identity Status Type TotalCount
-------- ------ ---- ----------
Batch-20200723 Synced Gmail 2
Login to Office 365 portal using uat1 or uat2 to verify all mail, calender and contact had been syned from G Suite to Office 365 successfully
Lastly, you can change the MX record to point to Office to complete the migration from G Suite to Office 365.