Deployment Best Practices
Use automated deployment for rules
Coding a rule within the Auth0 Dashboard rule editor is a great way to implement and test while still in the development stage. However, when it comes time to deploy into automated test or production environments, a more automated mechanism is required; copying and pasting code between Auth0 tenants is not a satisfactory method to employ.
Set up version control extensions
Changes made to a rule deployed to an Auth0 tenant will be made live immediately because changes instantly overwrite what is already there. We recommended that you use version control such as Git via GitHub or the like, is employed to provide change management capability.
Auth0 provides automated deployment methods for rules between Auth0 tenant environments. The following Auth0 integrations allow you to update rules from the version control system—both manually and automatically (for example, when a change in the version control system is detected): GitHub Actions, GitLab Pipelines, Bitbucket Pipelines, and Microsoft Azure Pipelines.
Use Deploy CLI tool for rule import and export
The Auth0 Deploy CLI tool can be used to automate deployment between Auth0 tenants. Deploy CLI works with files stored in the file system together with the Auth0 Management API and provides the capability to allow the export of rule assets from an Auth0 tenant, as well as import of them into an Auth0 tenant. Further, the tool provides for programmatic control over rule ordering and rule environment configuration as part of deployment automation. To learn more, read Deploy CLI Tool.
As a best practice, you should use the Auth Deploy CLI tool in almost all cases involving deployment to test or production environments, such as with the following integrations: GitLab Pipelines, GitHub Actions, Bitbucket Pipelines, and Microsoft Azure Pipelines. While the integrations can provide automated detection of changes deployed to the respective version control system, the Deploy CLI tool allows precise control of what’s deployed when, where, and how. To learn more about best practices, read Rules Best Practices.
Set up test tenants
We recommend that you set up a separate test tenant in Auth0 to provide safe testing of any rules before deploying to production. To learn more, read Set Up Multiple Environments.