Last Updated: Aug 20, 2024
Overview
This article addresses the following question:
- What is the best way to migrate users from a Database in one tenant to a Database in another tenant?
Applies To
- User Import / Export
- Database Migration
Solution
Exporting and importing users is the best method currently available to migrate users from one tenant to another. However, there are some caveats:
- Password hashes are not available via any of Auth0’s APIs for security reasons. A tenant administrator would need to raise a support ticket requesting this: User passwords .
- 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 mentioned here: 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, the steps to follow will be the following:
- Request a password hash export of the users via support ticket. Support will carry out some security checks before providing the file.
- 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.
- Convert the user export from ndjson format to JSON.
- Merge the password hash export data with the JSON export obtained in Step 2.
- Import the JSON into the new tenant.
More information about this topic can be read here.
Using Users Import/Export Extension
User Export
- Select Extensions > All Extensions tab and search for User Import/Export.
- Install the Extension and launch the Extension.
- If this is the first time, understand the required scopes and Continue.
- Click on Export and select Add Default Fields. Configure the Export Format and select which Connections for the export.
- Click on Export.
User Import
- Select Extensions > All Extensions tab and search for User Import/Export.
- Install or launch the Extension.
- Select Import on the right, and select which database the users are to be imported to.
- Drag or drop the JSON file and start importing users.