CLI Authentication

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
Prerequisites:
- The Pulumi CLI
- A Pulumi Cloud account and access token
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 :
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:
- Learn more about the available CLI commands in the Pulumi CLI documentation.
- Learn more about configuring Pulumi providers to work with Pulumi in the following resources:
- Learn more about the different Pulumi Cloud hosting options in the Managed Pulumi Cloud vs Self-Hosted Pulumi Cloud documentation