Azion CLI global options
Azion CLI options that the commands share, for the configuration folder, the token, logs, JSON output, and yes/no answers.
Global options are the flags that the Azion CLI commands share. They go after the command and its subcommand, as in azion list application --debug, and set the configuration folder, the token, the log level, the request timeout, the output format, and the answers to yes/no questions.
Usage
Add one or more global options to any command:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--config | -c | string | — | Path to a file that ends in .toml, not a folder. The folder that holds the path becomes the configuration folder for this command only, and no persistent setting changes. |
--debug | -d | — | — | Prints debug log lines, each with a timestamp, before the output of the command. |
--format | — | string | — | Prints the output as JSON when the value is json. |
--help | -h | — | — | Prints the description, synopsis, examples, and flags of the command. |
--log-level | -l | string | "info" | Log level: debug, info, or error. debug prints the same lines as --debug. |
--no-color | — | — | — | Prints the output with no color formatting. It is a CLI convention that keeps the output readable for automation that does not interpret color codes. |
--out | — | string | — | Path of a file to write the output to. The file always holds JSON, with or without --format json. |
--silent | -s | — | — | Prints nothing, not even the result of the command. Use it in automation. |
--timeout | — | int | 50 | Seconds the CLI waits for Azion to answer an HTTP request before the command fails. |
--token | -t | string | — | Personal token to save in the settings.toml of the profile. The command runs with it, and every later command uses it too. |
--version | -v | — | — | Prints the version of the CLI. azion -v prints the same line as azion version. |
--yes | -y | — | — | Answers yes to every yes/no question the command asks. |
Config
The Azion CLI keeps its settings in a configuration folder, ~/.azion by default. The folder holds profiles.json, which names the active profile, and one folder per profile with its own settings.toml. --token saves the personal token in that settings.toml.
--config points one command at another configuration folder. Pass a path inside that folder that ends in .toml, such as <config-folder>/settings.toml. The file does not need to exist, because the CLI uses only the folder that holds it.
Pass a path at the top of the configuration folder, not the settings.toml of a profile. With <config-folder>/default/settings.toml, the CLI takes default as the configuration folder, creates an empty profile inside it, and reports that you are not logged in.
Boolean flags
A flag that --help prints without a type is a boolean, such as --active on azion update dns-zone or --enabled on azion update dnssec. Write its value after an equals sign, as in --active=false. With a space, as in --active false, the command prints its success line and leaves the value unchanged.
Flags that --help types string and that take true or false, such as --active on azion update application, take the value after a space: --active false.
Questions and confirmations
Some commands ask a yes/no question before they continue. For example, azion create profile asks whether the new profile becomes your default profile. --yes answers yes to every question the command asks.
Without a terminal, as in a script with standard input closed, a question that ends in (Y/n) also takes yes. A profile that azion create profile creates there becomes the default profile, and azion delete profile deletes the profile.
azion unlink -y also answers yes to deleting the remote resources of the project. For more information, refer to Azion CLI unlink.
Updates from a JSON file
azion update reads the fields to change from a JSON file with --file. For most resources, the update is partial: fields that the file leaves out keep their values. For example, a rules-engine file without criteria keeps the criteria the rule already has.
Connector is the exception. azion update connector needs the whole connector in the file, as on create. For the file shape, refer to Azion CLI connector.
Examples
Each example shows the command and the output it prints.
Print the CLI version
This command prints the version of the Azion CLI:
The command prints one line:
Print debug logs
This command prints the account you are logged in with, and the debug log lines that come before it:
The debug lines show the HTTP timeout that applies, 50s by default:
Print the output as JSON
This command describes the application with ID 1234567890 as JSON:
The command prints the full object of the application:
Write the output to a file
This command writes the description of the same application to app-describe.txt, without --format json:
The command prints the path of the file:
The file holds the same JSON object that --format json prints, whatever its extension. A list command such as azion list workload --out workloads.txt also writes JSON, with the column names in columns and one array per row in lines.
Set a boolean flag
This command turns off the DNS zone with ID 1234, with the value after an equals sign:
The command confirms the update:
azion describe dns-zone --zone-id 1234 --format json then reports "active": false.
Save a token for another configuration folder
This command saves a personal token in another configuration folder and runs azion whoami with it:
The command saves the token in the default profile of that folder, then prints the account:
Set the request timeout
This command lists the applications of your account and waits 1 second for Azion to answer:
When the answer takes longer than the timeout, the command fails with exit code 1:
Run a command without output
This command lists the applications of your account and prints nothing:
The command prints no line and exits with code 0.