Google ACE Setting Up a Cloud Solution Environment Practice Question
A developer wants to authenticate to GCP from their local machine using their own user account to run gcloud commands that interact with a project. They have already installed the Cloud SDK. Which command should they use to authenticate with their Google 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` authenticates using a user account (OAuth 2.0) and is appropriate for interactive use. `gcloud auth application-default login` is for application credentials.
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 init
Why it's wrong here
gcloud init is a bootstrapping command that initializes a new configuration, sets the default project, region, and zone, and can prompt you to authenticate if no credentials exist; it is not the dedicated authentication command. Its authentication phase simply invokes the same underlying OAuth flow as gcloud auth login, but the command's primary responsibility is environment setup rather than establishing the user's Google identity. Running gcloud init as an authentication step is indirect and unnecessary when the developer only needs to authenticate gcloud from their local machine.
- ✗
gcloud auth activate-service-account
Why it's wrong here
gcloud auth activate-service-account authenticates using a service account key file (JSON or P12) rather than a user's Google account. This command installs the service account's private key as the active credential for gcloud and is intended for service account identities in automated workflows, CI/CD pipelines, or server-to-server API calls. A developer authenticating as themselves on a local machine needs an OAuth-based user credential, not a service account key, so this command is inappropriate for the stated requirement.
- ✓
gcloud auth login
Why this is correct
gcloud auth login is the correct command because it launches an OAuth 2.0 authorization flow, typically opening a browser where the developer signs in with their Google account and grants consent to GCP scopes. Upon successful authentication, it saves the resulting user credentials in the credentials directory and sets them as the active account for subsequent gcloud CLI operations. This is the standard, direct way for a human developer to authenticate the gcloud command-line tool with their personal or Google Workspace user identity from a local machine.
- ✗
gcloud auth application-default login
Why it's wrong here
gcloud auth application-default login creates Application Default Credentials (ADC) for use by client libraries, such as Google Cloud client SDKs, and local application code—not for the gcloud CLI itself. The credentials generated by this command are stored separately (often in ~/.config/gcloud/application_default_credentials.json) and do not affect or override the active account used by the gcloud command. Since the developer wants to authenticate the gcloud CLI, this command misdirects the authentication to application code rather than the CLI tool, making it incorrect for the question.
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.