# Azion CLI login

The Azion CLI `login` command logs in to your Azion account and saves a [personal token](/en/documentation/fundamentals/personal-tokens/) on your machine. The CLI uses that token to authorize the commands you run after the login. The options every command accepts, such as `--help`, `--token`, and `-c`, are on [Global options](/en/documentation/devtools/cli/globals/).

---

## Usage

`azion login` asks its questions in the terminal and logs in with the method you choose:

```bash
azion login [flags]
```

| Flag         | Short | Type   | Default | Description         |
| ------------ | ----- | ------ | ------- | ------------------- |
| `--password` | —     | string | —       | Your password.      |
| `--username` | —     | string | —       | Your email address. |

The command asks these questions, in this order:

1. `Would you like to create a new profile for this login? (Y/n)`. With yes, it asks for the name of the [profile](/en/documentation/devtools/cli/resources/profile/) in `Enter a name for the new profile:`.
2. `Choose a login method:`, with the options *Log in via browser* and *Log in via terminal*.
3. With *Log in via terminal*, `Enter your email address:`.

Passing `--username` does not skip the profile question or the login method question. Run the command in an interactive terminal: without one, it stops at the profile name question with `Failed to get profile name`.

To authorize the CLI without these questions, such as in a CI job, pass a personal token with the global `-t` option. The CLI saves the token in the `settings.toml` file of the profile and uses it for every later command.

---

## Examples

Each example shows the questions the command prints, up to the point where it waits for your answer.

### Choose a login method

This command starts the login:

```bash
azion login
```

The command asks whether to create a profile, then shows the login methods. In this output, the answer to the profile question is `n`:

```text
🤔 Would you like to create a new profile for this login? (Y/n) n
? Choose a login method:  [Use arrows to move, type to filter]
> Log in via browser
  Log in via terminal
```

With *Log in via terminal* selected, the command asks for the email address of your account:

```text
? Choose a login method: Log in via terminal
? Enter your email address:
```

### Pass the email address

This command passes the email address of the account with `--username`:

```bash
azion login --username you@example.com
```

The command still asks the profile question and shows the login methods:

```text
🤔 Would you like to create a new profile for this login? (Y/n) n
? Choose a login method:  [Use arrows to move, type to filter]
> Log in via browser
  Log in via terminal
```

---

## Related resources

- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `-t` to authorize the CLI with a personal token.
- [Azion CLI logout](/en/documentation/devtools/cli/logout.md): How to log out and remove the personal token saved on your machine.
- [Azion CLI whoami](/en/documentation/devtools/cli/whoami.md): How to check which account and profile your commands run with.
- [Azion CLI personal-token](/en/documentation/devtools/cli/resources/personal-token.md): The commands that create the personal token you pass with `-t`.
