Azion CLI profile
Azion CLI commands that create and delete profiles, the local CLI configurations that each hold a personal token, with every flag and its type.
The Azion CLI profile commands create and delete profiles, the CLI configurations on your machine that each hold a personal token and the account details the CLI stores with it. These commands change the CLI configuration in ~/.azion, not the resources of your account. The options every command accepts, such as --config, --token, and -y, are on Global options.
There is no list or describe command for profiles. azion profiles shows your profiles in an interactive selector (? Choose a profile:) and needs a terminal, and azion whoami prints the name of the active profile.
Create
azion create profile creates a profile with the name and the personal token you pass:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--file | — | string | — | Path to a TOML file with the settings of the profile. The command reads the Token key and never reads the name, so pass --name too. |
--name | — | string | — | Required, with --file too. Name of the profile. Without it, the command asks ? Please inform a name for the new profile. |
--personal-token | — | string | — | Personal token the profile uses to authorize commands. |
The command asks Would you like to make '<name>' your default profile? (Y/n). With yes, the profile becomes the active one. Without a terminal to answer, the question takes yes. To keep the active profile in a script, pipe the answers, as in Use a TOML file.
This command creates a profile named my-profile with a personal token you created with azion create personal-token:
The command asks whether you agree to anonymous data collection and whether to make the profile the default. Without a terminal, both questions take yes:
After this command, azion whoami prints Active Profile: my-profile.
The command checks the token before it saves the profile. An invalid token fails, and no profile is created:
Delete
azion delete profile deletes a profile and its folder in ~/.azion:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--name | — | string | — | Required. Name of the profile to delete. Without it, the command asks you to select the profile from a list (? Choose a profile to delete:). |
Unlike the delete commands of account resources, this command asks Are you sure you want to delete profile '<name>'? This action cannot be undone (Y/n). With -y, or without a terminal to answer, the question takes yes.
This command deletes the profile named my-toml-profile:
The command prints the question and confirms the deletion:
A name that matches no profile fails with Error: Profile 'my-missing-profile' not found.
Use a TOML file
azion create profile reads the personal token of the profile from a TOML file with --file. The command reads the Token key. It does not read the name from the file, so --name is required on the command line.
This file holds the personal token of the profile:
This command creates a profile named my-toml-profile from the file. The piped answer n keeps the active profile:
The command confirms the profile and does not set it as the default:
The profile settings are in ~/.azion/my-toml-profile/settings.toml, and its Token is the one from the file. Without --name, the command asks for the name and creates no profile.