Reputation: 77
I'm doing GoogleCloudReady Facilitator Program workshop labs, I'm facing a problem while doing the labs.
when I try to run the gcloud auth list
command then I'm facing
To login, run:
$ gcloud auth login `ACCOUNT`
My expected output should be
[core]
project = <project_ID>
as well as according to the documentation.
please help me out my time is passing.
Upvotes: 3
Views: 1354
Reputation: 854
As it was previously mentioned by some comments, you need to authenticate first. Depending on which guide or lab you are following, the configuration or initialization might be set up for you.
Eg.: in this qwiklab there is no need to run gcloud auth login
because the shell is initialized for you in a profile, and so you can use gcloud auth list
without running the first command.
Outside the labs, in the console or using the CLI, you need to make some Configurations:
A configuration is a set of gcloud CLI properties. A configuration works like a profile.
When you start using the gcloud CLI, you'll work with a single configuration named default and you can set properties by running
gcloud init
orgcloud config set
. This single default configuration is suitable for most use cases.
This is the first step when setting up the gcloud CLI, Initializing the gcloud CLI.
gcloud init
performs the following setup steps:
Authorizes the gcloud CLI to use your user account credentials to access Google Cloud, or lets you select an account if you have previously authorized access
Sets up a gcloud CLI configuration and sets a base set of properties, including the active account from the step above, the current project, and if applicable, the default Compute Engine region and zone
You can run the following as alternatives to gcloud init:
Command | Description |
---|---|
gcloud auth login |
Authorize with a user account without setting up a configuration. |
gcloud auth activate-service-account |
Authorize with a service account instead of a user account. Useful for authorizing non-interactively and without a web browser. |
... | ... |
So, depending on the scenario, you might need to only indicate the shell which user account you are using (in case it is not specified as in this image from the previous mentioned qwiklab that does all the initialization for you) using gcloud auth login
, or you might need to set up a whole new configuration profile with gcloud init
.
In this case, you are listing accounts without first authenticating, that's why it prints that message.
Once you have executed the login/init command, you can get the active authenticated gcloud account or listing accounts as you have previously tried, to confirm you are now using the correct account.
Upvotes: 1