easyMultiple ChoiceObjective-mapped
Google ACE Practice Question: Which gcloud CLI command authenticates a…
Which gcloud CLI command authenticates a developer's local environment with their Google account?
⚠ Common exam trap
Test-takers frequently confuse configuration commands (like `gcloud config set account`) with authentication commands, mistakenly thinking setting an account name is sufficient to establish credentials, when in fact it only selects a pre-existing authenticated account.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
gcloud auth login
`gcloud auth login`, is correct because it initiates the OAuth 2.0 flow to authenticate the gcloud CLI with a user's Google account, storing the resulting credentials locally for subsequent API calls. This command is the standard way to authorize a developer's local environment for the first time or when switching users.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
gcloud config set account [EMAIL]
Why it's wrong here
`gcloud config set account [EMAIL]` merely switches the *active* account among credentials that are already stored on the machine. It does not perform authentication, initiate an OAuth flow, or obtain any new credentials. If the specified account has not previously been authenticated via `gcloud auth login`, this command will not make it work—it only updates the configuration property pointing to an existing authenticated identity.
- ✓
gcloud auth login
Why this is correct
`gcloud auth login` is the correct way to initiate interactive user authentication via Google's OAuth 2.0 flow. It opens a browser to obtain an access token and refresh token, then securely stores those credentials in your local `~/.config/gcloud/` directory. After this step, all `gcloud` commands automatically use these stored credentials for the active account, eliminating the need to re-authenticate for each command.
- ✗
gcloud init --authenticate
Why it's wrong here
`gcloud init` is designed for first-time setup of the Cloud SDK, guiding you through selecting a project and optionally performing authentication via a guided flow. However, it does not accept an `--authenticate` flag; the flag is simply invalid and will cause gcloud to exit with a usage error. To authenticate without re-initializing the entire SDK, you should use the dedicated `gcloud auth login` command instead.
- ✗
gcloud accounts activate
Why it's wrong here
The `gcloud accounts activate` command does not exist because `accounts` is not a valid command group in the gcloud CLI. All authentication-related commands live under the `gcloud auth` group, such as `gcloud auth login` and `gcloud auth list`. Running `gcloud accounts activate` will trigger an unrecognized command error, not an authentication flow.
Go deeper
Related to this question
About these practice questions
One of 769 original ACE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.