The Deploy CLI can not only be used as a standalone CLI, but as a node module. Doing so allows you to manage Auth0 resources within expressive node scripts. Refer to the Configuring the Deploy CLI documentation for a comprehensive list of configuration settings.
Fetches configurations from Auth0 tenant to the local machine.
import { dump } from 'auth0-deploy-cli';
dump({
output_folder: './local',
format: 'yaml',
config: {
AUTH0_DOMAIN: '<YOUR_AUTH0_TENANT_DOMAIN>',
AUTH0_CLIENT_ID: '<YOUR_AUTH0_CLIENT_ID>',
AUTH0_CLIENT_SECRET: '<YOUR_AUTH0_CLIENT_SECRET>',
},
})
.then(() => {
console.log('Auth0 configuration export successful');
})
.catch((err) => {
console.log('Error during Auth0 configuration export:', err);
});
Options: yaml
or directory
. Determines the file format of the exported resource configuration files. See: Available Resource Configuration Formats.
Path. Specifies the target directory for configuration files to be written to.
Object. Configures behavior of utility. Refer to the list of all configurable properties.
Path. Specifies the user-defined configuration file (config.json). Refer to the list of all configurable properties.
Boolean: When enabled, will export the identifier fields for each resource. Default: false.
Boolean. Indicates if the tool should ingest environment variables or not. Default: false
.
A url for proxying requests. Only set this if you are behind a proxy.
Applies configurations from local machine to Auth0 tenant.
Path. Specifies the location of the resource configuration files. For YAML formats, this will point to the tenant.yaml file. For directory formats, this will point to the resource configuration directory.
Object. Configures behavior of utility. Refer to the list of all configurable properties.
Path. Specifies the user-defined configuration file (config.json). Refer to the list of all configurable properties.
Boolean: When enabled, will export the identifier fields for each resource. Default: false
.
Boolean. Indicates if the tool should ingest environment variables or not. Default: false
.
A url for proxying requests. Only set this if you are behind a proxy.
import { deploy } from 'auth0-deploy-cli';
deploy({
input_file: './local/tenant.yaml',
config: {
AUTH0_DOMAIN: '<YOUR_AUTH0_TENANT_DOMAIN>',
AUTH0_CLIENT_ID: '<YOUR_AUTH0_CLIENT_ID>',
AUTH0_CLIENT_SECRET: '<YOUR_AUTH0_CLIENT_SECRET>',
},
})
.then(() => {
console.log('Auth0 configuration applied to tenant successful');
})
.catch((err) => {
console.log('Error when applying configuration to Auth0 tenant:', err);
});