---
title: "CLI Authentication"
description: "The [`pulumi login`](/docs/iac/cli/commands/pulumi_login/) command is used to login to the Pulumi Cloud from the [Pulumi CLI](/docs/cli/). Logging in to the Pulumi Cloud enables you to manage your state, resources, and secrets in a secure way. In this tutorial, we'll demonstrate how to authenticate to the Pulumi Cloud using the Pulumi CLI."
url: "https://www.pulumi.com/dev/tutorials/cli-authentication/"
image: "https://www.pulumi.com/assets/og/dev/tutorials/cli-authentication.png"
---

# CLI Authentication

The [`pulumi login`](/docs/iac/cli/commands/pulumi_login/) command is used to login to the Pulumi Cloud from the [Pulumi CLI](/docs/cli/). Logging in to the Pulumi Cloud enables you to manage your state, resources, and secrets in a secure way. In this tutorial, we'll demonstrate how to authenticate to the Pulumi Cloud using the Pulumi CLI.

## What you'll learn

- How to authenticate using a personal access token
- How to authenticate using the browser

## Prerequisites

- The [Pulumi CLI](https://www.pulumi.com/docs/install/)
- A [Pulumi Cloud account](https://app.pulumi.com/signup) and an [access token](https://www.pulumi.com/docs/administration/access-identity/access-tokens/)

## Logging into the CLI

When you run the `pulumi login` command, you will be presented with a prompt that will offer you two methods of authenticating: either via access token or via the browser.

```bash
$ pulumi login
Manage your Pulumi stacks by logging in.
Run `pulumi login --help` for alternative login options.
Enter your access token from https://app.pulumi.com/account/tokens
    or hit <ENTER> to log in using your browser                   :
```

> **Note**
>
> By default, logging into the Pulumi CLI will log you into the managed Pulumi Cloud backend, but it is also possible to use this command to login to a self-hosted Pulumi Cloud backend. This is out of the scope of this tutorial, but you can learn more by visiting the [Managing state & backend options documentation](https://www.pulumi.com/docs/iac/concepts/state-and-backends/#logging-into-and-out-of-state-backends).

In the next steps, you will learn how to login using both options, and you will also learn how to logout of the Pulumi CLI when you are done.

### Authenticate using a token

Run the `pulumi login` command to initiate the authentication process. When prompted, copy and paste your token into the command line and press enter.

Video: Running the pulumi login command with access token

In the CLI, you will receive a message to indicate that you've successfully logged in.

### Authenticate using the browser

Run the `pulumi login` command to initiate the authentication process. When prompted, press enter to be directed to the browser. From there, login with the appropriate credentials:

Video: Running the pulumi login command with browser

In both the browser and the CLI, you will receive a message to indicate that you've successfully logged in.

Video: Showing browser authentication completed

## Logging out of the CLI

When you want to logout of the Pulumi CLI, run the [pulumi logout](https://www.pulumi.com/docs/iac/cli/commands/pulumi_logout/) command. You will receive the following output that indicates you were logged out successfully:

```bash
$ pulumi logout
Logged out of https://api.pulumi.com
```

## Next Steps

In this tutorial, you learned how to authenticate to the Pulumi CLI using the browser and using a Pulumi access token. To learn more about using the CLI to create and manage resources in Pulumi, take a look at the following resources:

- Learn more about the available CLI commands in the [Pulumi CLI documentation](https://www.pulumi.com/docs/iac/cli/commands/).
- Learn more about configuring Pulumi providers to work with Pulumi in the following resources:

  - [AWS Configuration](https://www.pulumi.com/docs/iac/get-started/aws/begin/#configure-pulumi-to-access-your-aws-account)
  - [Azure Configuration](https://www.pulumi.com/docs/iac/get-started/azure/begin/#configure-pulumi-to-access-your-microsoft-azure-account)
  - [Google Cloud Configuration](https://www.pulumi.com/docs/iac/get-started/gcp/begin/#configure-pulumi-to-access-your-google-cloud-account)
  - [Kubernetes Configuration](https://www.pulumi.com/docs/iac/get-started/kubernetes/begin/#configure-kubernetes)
- Learn more about the different Pulumi Cloud hosting options in the [Managed Pulumi Cloud vs Self-Hosted Pulumi Cloud documentation](https://www.pulumi.com/docs/pulumi-cloud/self-hosted/)
