Set Up Multiple Environments

Set Up Multiple Environments

Development, staging, and production environments are easy to set up in Auth0. Simply create a new tenant for each environment to guarantee isolation between them. You can easily switch between tenants using the tenant chooser from the top left menu on the Dashboard. You can also configure different administrators for each.

Production rate limits only apply to tenants tagged as Production. Ensure your tenant's environment tag is set to Production before going live, and note the differences between rate limits for different tenants, environments, and fee structures.

You can name your multiple environments any way you prefer. For production environments, we strongly recommend using custom domains.

If you have an Enterprise subscription plan you can link tenants that which become identical to your Production account in terms of paid/upgraded features for use in a development/staging/testing environment.

Tag the environment

For each new tenant created, you should specify its environment. You can assign Environment Tags to your tenants to differentiate between development, staging, and production environments.

If your tenant is mixed use, choose the higher environment. For example, a tenant used for both development and production should be set to Production.

  1. To assign an Environment Tag to a tenant, go to the Dashboard > Settings > General.

    Dashboard Tenant Settings General Settings tab

  2. Under Assign Environment Tag, identify your tenant's environment as Development, Staging, or Production.

    undefined
  3. After selecting the environment, click Save.

Migration

Through the Management API v2, you can automate the migration of assets (rules, database connections, and so forth) between tenants.

For easier configuration management, save your configuration values in the Dashboard, instead of hardcoding them into your rules or db connections scripts.

For example, let's say you want to set a URL for logs. One way to do it is to hardcode it in the rule:

function(user, context, callback){
      var log_url = 'https://someurl/log';
      ...
    }

Was this helpful?

/

This code, however, is not portable since this URL will likely change from development to production.

The recommended way of working with code that you need to use/move from development to product is via Rules section. If you have not yet created a rule, you'll need to do so. (Otherwise, jump to step 4.)

  1. Click Create Your First Rule.

  2. Choose the empty rule template.

  3. Enter a name for your new rule, and click Save.

  4. Go to Dashboard > Rules, and scroll to the bottom of the page to set your configuration values (we will use log_url for the key name, and https://someurl/log for value), then click Create.

  5. Now, you can write your rule. Edit the rule you created, enter the following code in the code area, and click Save.

    function(user, context, callback){
          var log_url = configuration.log_url;
          ...
        }

    Was this helpful?

    /

This code is portable, and when you migrate to production, you only need to change this setting instead of searching your scripts.

AD/LDAP Connectors

If you use multiple Auth0 tenants with AD/LDAP, you will need to create an AD/LDAP Connection and set up an AD/LDAP Connector for each tenant. This is because each AD/LDAP Connector is tied to a specific Connection within an Auth0 tenant.

Multiple AD/LDAP Connectors can point to the same AD or LDAP directory, but each AD/LDAP Connector can only be used by one Connection within one Auth0 tenant.

If you have multiple AD/LDAP directories against which users will authenticate (for example, to support different departments or customers, each with their own directory), you can set up multiple AD/LDAP Connectors within each Auth0 tenant.

Learn more