Newer Version Available

This content describes an older version of this product. View Latest

CLI Parameter Resolution Order

Because you can specify parameters for a given CLI command in several ways, it’s important to know the order of parameter resolution.

The CLI resolves command-line parameters and arguments, definition files, environment variables, and settings in this order:

  1. Command-line parameters and arguments, such as --loglevel, --targetusername, or sandboxName=FullSbx.
  2. Parameters and options listed in a file specified on the command line. An example is a scratch org definition in a file specified by the --definitionfile parameter of force:org:create. If you indicate a parameter or an argument on the command line that differs from what exists in the definition file, the command line takes precedence.
  3. Environment variables, such as SFDX_LOG_LEVEL.
  4. Local CLI configuration values, such as defaultusername or defaultdevhubusername. To view the local values, run config:list from your project directory.
  5. Global CLI configuration values. To view the global values, run config:list from any directory.

Remember, command-line parameters are at the top of the precedence list. For example, if you set the SFDX_LOG_LEVEL environment variable to INFO but you specify --loglevel DEBUG when running a command, the log level is DEBUG.

If you specify the --targetusername parameter for a specific CLI command, the CLI command connects to an org with that username. It does not connect to the org previously set using defaultusername.