Migrating Database users from one tenant to another tenant

Problem statement

What is the best way to migrate users from a Database in one tenant to a Database in another tenant?

Solution

Exporting and importing users is the best method currently available to migrate users from one tenant to another. However, there are some caveats:

  1. Password hashes are not available via any of Auth0’s APIs for security reasons. A tenant administrator would need to raise a support ticket to request this:
  1. Users need to be imported in JSON format, however for performance reasons, users are exported from Auth0 tenants in ndjson format, so the export would have to be converted as described here:

https://auth0.com/docs/manage-users/user-migration/bulk-user-exports#json-compatible-format

For the users not having to go through a password reset flow when logging into the new tenant, the password hash would need to be included in the import file. If this is the case, you need to follow these steps:

  1. Request a password hash export of the users via support ticket. Support will carry out some security checks before providing the file.
  2. This file would only include hashes and IDs. For the rest of the profile data, it is necessary to perform an export from the tenant using the Import/export extension or the Management API.
  3. Convert the user export from ndjson format to JSON.
  4. Merge the password hash export data with the JSON export obtained in Step 2.
  5. Import the JSON into the new tenant.

More information about this topic can be found here:

3 Likes