So, you have come across a situation where you have to migrate users between Office 365 tenants. Its awfully painful and extremely tedious to recreate every single user... the good news is that O365 provides PowerShell modules that allow export users into a CSV file. We can then use the CSV to bulk import users into the new O365 tenant.

Here is a script to export users into a CSV : 

 # Connect to MSO
Connect-MsolService

# Get all users
$users = Get-MsolUser
$users |
Select-Object -property @{name="User Name";Expression={$_.UserPrincipalName}},
@{name="First Name";Expression={$_.FirstName}},
@{name="Last Name";Expression={$_.LastName}},
@{name="Display Name";Expression={$_.DisplayName}},
@{name="Job Title";Expression={$_.JobTitle}},
@{name="Department";Expression={$_.Department}},
@{name="Office Number";Expression={$_.Office}},
@{name="Office Phone";Expression={$_.PhoneNumber}},
@{name="Mobile Phone";Expression={$_.MobilePhone}},
@{name="Fax";Expression={$_.Fax}},
@{name="Address";Expression={$_.StreetAddress}},
@{name="City";Expression={$_.City}},
@{name="State or Province";Expression={$_.State}},
@{name="Zip or Postal Code";Expression={$_.PostalCode}},
@{name="Country or Region";Expression={$_.Country}} |
Export-Csv c:\users.csv -NoTypeInformation

 

Now use the Bulk Import feature on the new tenant to import the CSV as follows:

  1. In the header, click Admin.
  2. In the left pane, under Management, click Users.
  3. On the Users page, click the arrow next to New, and then click Bulk add.
  4. On the Select the above exported CSV file page and then click Next.
  5. On the Verification results page, confirm that there are no errors in your CSV file and that the number of users to import is correct. To review errors in the log file, click View. If you have errors in your CSV file, click Back. Open your CSV file and make the corrections, and then perform step 4 again. Once your CSV file has passed verification, click Next.
  6. On the Settings page, under Set sign-in status, select Allowed to allow users to sign in to Office 365 and access licensed services, or Blocked to block users from signing in to Office 365 and accessing licensed services. Under Set user location, select the users’ work location, and then click Next.
  7. On the Assign licenses page, select the licenses that you want to assign to all of the users being imported, and then click Next.
  8. On the Send results in email page, select Send email to send a user name and temporary password for the added users to yourself and/or recipients of your choice. Enter email addresses separated by semicolons (;), and then click Create.
  9. On the Results page, a list of successfully imported users and their temporary passwords is displayed, as well as any errors that occurred during the import process. If a user was not imported, there will be a status message indicating the reason. If you chose not to send yourself this information by email, you can click View to open the log file, and then print or save the information.

That's it!