Using the Same TenantID for 2 Different Environments

Overview

This article will help you share the same Microservices instance between DEV and PROD. A tenantID maps a DNN instance to a Microservice instance in the cloud.  The tenantID is composed of the Host GUID and a hash of the connection string which is usually different between instances (e.g PROD and DEV).

 

Prerequisites

  • Access to the DNN file structure.

 

Solution

Note:  Sharing the same Microservices instance between DEV and PROD is not recommended as any changes on DEV would reflect on PROD.

Method 1

The recommended approach is to contact the Support team through a Support ticket and have them map the 2 different tenantIDto the same space that way the content is shared among both instances. 

<supportagent>contact the SaaS team through a Jira ticket</supportagent>

Method 2

The other approach is to set the environments in a way that they both have the same tenantIDThe end goal is to have the exact same connection string for both the PROD and DR server in order to have the same tenantID. This is true in most cases since the Host GUID would be the same as these are usually copies of each other.

The way to achieve this is to have the same database name which is fairly simple if these are separate DB servers. As per having the exact same Data Source Server (DB Server), this is a more troublesome process, but it can be achieved if these are hosted locally or through the use of the host's files.

  • For example, if a site is hosted locally one can simply have this is the CS for both servers which will result in the same tenantID:

<add name="SiteSqlServer" connectionString="Data Source=localhost;Initial Catalog=databasename; ...
  • On the other hand, if you are using IPs for the data source this is not possible since otherwise, both servers will be pointing to the same database.
  • Nevertheless, if these environments are in different subnets it is possible to use the same IP for 2 different DB servers.
  • In case we are already using IPs and both environments are in the same network, then the other option is to come up with a specific server name for the DB servers, use that in your connection string and then have the hosts file on each web server point to a different DB server.
  • For example:

Server 1:
192.168.0.x DBSERVERNAME

Server 2:
192.168.0.y DBSERVERNAME
  • and both would use the same connection string:

<add name="SiteSqlServer" connectionString="Data Source=DBSERVERNAME;Initial Catalog=databasename; ...

 

Testing

If the fix works, then 2 different environments will have the same tenantID.

Comments

0 comments

Article is closed for comments.