Azion CLI profiles
Azion CLI command that lists your CLI profiles in an interactive selector and makes the profile you choose the active one.
The Azion CLI profiles command shows the profiles configured on your machine and switches the active one. A profile holds the personal token of one account, so several profiles let you work with several accounts or environments from the same machine. To create or delete a profile, use the commands on Azion CLI profile. The options every command accepts, such as --debug and --timeout, are on Global options.
Usage
azion profiles opens a selector with every profile you configured, unless you pass --refresh:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--help | -h | — | — | Prints the help of the command. |
--refresh | — | — | — | Re-checks which Azion API version the account of the active profile uses and saves the result, instead of opening the selector. Use it when the account changed version. |
The selector is interactive: move the cursor with the arrow keys and press Enter to choose a profile. The command needs a terminal to read your choice. Without one, as in a script, it prints the list and exits with Error: EOF. No command lists the profiles without a selector.
The selector always opens with the cursor on default, whichever profile is active. To see the active profile, run azion whoami, which prints it as Active Profile.
Examples
Switch the active profile
This command opens the selector on a machine with two profiles, default and my-profile:
The command lists the profiles, with the cursor on default:
After you move the cursor to my-profile and press Enter, the command replaces the list with your choice and prints nothing else:
my-profile is then the active profile, and ~/.azion/profiles.json names it:
Create a profile
The selector lists only the profiles that exist. azion create profile adds one, with a personal token you created with azion create personal-token:
The command checks the token, asks whether to make the new profile the default, and creates nothing when the token is invalid. For every flag it takes, refer to Azion CLI profile.
Re-check the API version of an account
The CLI detects which Azion API version an account uses and remembers the answer. This command checks it again for the active profile:
The command reads the version from Azion, saves it, and opens no selector. Use it when the account moved between API versions and the CLI still acts on the version it recorded before. It fails when no token is available, or when the token no longer authorizes the account.