Deploy CLI Tool
Before you start
Set up an Auth0 Tenant.
The Auth0 Deploy CLI is a tool that helps you manage your Auth0 tenant configuration. It integrates into your development workflows as a standalone CLI or as a node module.
Supported resource types:
resource servers (APIs),
Multi-Environment Oriented: Designed to help you test your applications' Auth0 integrations from feature branch all the way to production.
Keyword Replacement: Shared resource configurations across all environments with dynamic keyword replacement.
Versatile: Integrate into your CI/CD workflows either as a CLI or as a Node module.
This guide will help you to a working implementation of the Deploy CLI tool used as a standalone CLI. There are three main steps before the Deploy CLI can be run:
Install the Deploy CLI
To run as a standalone command-line tool:
npm install -g auth0-deploy-cli
Create a dedicated Auth0 application
In order for the Deploy CLI to call the Management API, a dedicated Auth0 application must be created to make calls on behalf of the tool:
Go to Auth0 Dashboard > Applications > Applications.
Select + Create Application.
Give it a descriptive name (such as “Deploy CLI”).
Select Machine to Machine Applications for the Application Type.
Switch to the Authorize Machine to Machine Application view:
Select Auth0 Management API.
Select the appropriate permissions for the resources you wish to manage. Refer to the Client Scopes section for more information.
The designated application needs to be granted scopes in order to allow the Deploy CLI to execute Management operations.
The principle of least privilege is abided, so it will operate within the set of permissions granted. , you'll need to select
read:clients, but it’s recommended to select
update:* permissions for all resource types within management purview. To enable deletions, you
Configure the Deploy CLI
You can configure the Deploy CLI in two ways:
Use the configuration file (
Set environment variables.
The decision to choose one or both would depend on your specific use case and preferences. To learn more, read Configuring the Deploy CLI.
For this example, set the following environment variables:
These values can be found in the Settings tab for the dedicated Auth0 application you created previously.
Call the Deploy CLI
The Deploy CLI
export command can be run with the following command:
a0deploy export --format=yaml --output_folder=local
Once the process completes, observe the resource configuration files generated in the local directory. Then, run the
import command to push the configuration from your local machine to your Auth0 tenant:
a0deploy import --config_file=config.json --input_file local/tenant.yaml
For a comprehensive list of flags and options, please read Using as a CLI.