1. Tutorials
  2. CLI Authentication

CLI Authentication

The pulumi login command is used to login to the Pulumi Cloud from the Pulumi 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.

In this tutorial, you'll learn:

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

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.

$ 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                   :
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.

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.

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:

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

Logging out of the CLI

When you want to logout of the Pulumi CLI, run the pulumi logout command. You will receive the following output that indicates you were logged out successfully:

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