You received a JSON service account key and want to use it to authenticate gcloud commands. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Run gcloud auth activate-service-account and specify the service account key file..
Why this is the answer
To authenticate gcloud commands using a JSON service account key, you should use the gcloud auth activate-service-account command. This command is specifically designed for activating service accounts with a key file, allowing gcloud to use the credentials provided in that file for subsequent operations. gcloud auth login is used for authenticating with a user account, typically through a web browser, not with a service account key file. Placing the key file in the Cloud SDK installation directory or your home directory with specific names (like credentials.json or GOOGLEAPPLICATIONCREDENTIALS) is incorrect for directly activating gcloud commands. While GOOGLEAPPLICATIONCREDENTIALS is an environment variable used by client libraries to find credentials, it doesn't activate them for the gcloud CLI itself.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed