# Azion CLI profile

The Azion CLI `profile` commands create and delete [profiles](/en/documentation/devtools/cli/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](/en/documentation/devtools/cli/globals/).

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:

```bash
azion create profile [flags]
```

| 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](#use-a-toml-file).

This command creates a profile named `my-profile` with a personal token you created with `azion create personal-token`:

```bash
azion create profile --name my-profile --personal-token "[TOKEN VALUE]"
```

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:

```text
🤔 To better understand user needs and enhance our application, we gather anonymous data. Do you agree to participate? (Y/n) 🤔 Would you like to make 'my-profile' your default profile? (Y/n) Profile 'my-profile' created successfully and set as default
```

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:

```text
🤔 To better understand user needs and enhance our application, we gather anonymous data. Do you agree to participate? (Y/n) Error: The provided token is invalid. You must create a new token and configure it to use with the CLI. Manage your personal tokens on RTM using the Account Menu > Personal Tokens and configure the new token with the command 'azion -t <new_token>'
```

---

## Delete

`azion delete profile` deletes a profile and its folder in `~/.azion`:

```bash
azion delete profile [flags]
```

| 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`:

```bash
azion delete profile --name my-toml-profile -y
```

The command prints the question and confirms the deletion:

```text
🤔 Are you sure you want to delete profile 'my-toml-profile'? This action cannot be undone (Y/n) Profile 'my-toml-profile' deleted successfully
```

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:

```text
Token = "[TOKEN VALUE]"
```

This command creates a profile named `my-toml-profile` from the file. The piped answer `n` keeps the active profile:

```bash
printf 'n\nn\n' | azion create profile --name my-toml-profile --file profile.toml
```

The command confirms the profile and does not set it as the default:

```text
🤔 Would you like to make 'my-toml-profile' your default profile? (Y/n) Profile 'my-toml-profile' created successfully
```

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.

---

## Related resources

- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `--config`, `--token`, and `-y`.
- [Azion CLI profiles](/en/documentation/devtools/cli/profiles.md): The interactive selector that shows the profiles you created.
- [Azion CLI personal-token](/en/documentation/devtools/cli/resources/personal-token.md): The commands that create the personal token a profile holds.
- [Azion CLI whoami](/en/documentation/devtools/cli/whoami.md): How to check which profile and account your commands run with.
