Base solution for your next web application
Open Closed

Properly move tenant database to another enovironment/location #6572


User avatar
0
leonkosak created

One of our customers have multitenant solution with each tenant in separated database. We are now in transition from local environment to Azure (our Azure envoronment vith our host database). The only problem is, that users cannot login in tenant because ASP.NET Zero cannot authenticate (Login failed error). I can see logs (AbpAuditLogs table) in each tenant database (for login failed), so the database for tenant is resolved correctly in Azure environment. I tried to set correct new TenantId in each table (because we just move tenant databases in existing environment in Azure and not host database in local environment).

We tried to update all TenantId values in tenant databases, but it does not help.

What can we do now? What steps are required to move tenant database to other environment.

Thank you for suggestions.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    @leonkosak I think you have figured it out :)

  • User Avatar
    0
    leonkosak created

    Basically, my stupidity. We moved the current database from a local environment to Azure and then created a new tenant with the connection string to this database. But the tenant id was different from the value in the new host environment.

    Correct steps:

    • Create a blank new database in a new environment
    • Create a new tenant in a new environment with a connection string to this blank database
    • Restore existing tenant database to the new environment
    • In all tables with TenantId column in a database, update value to new tenant id value

    Of course, the version of an application (and database) has to be the same during migration.