
Answer-first summary for fast verification
Answer: Run the gcloud auth activate-service-account command and point it to the private key.
**Correct Answer: C** - **A** is incorrect because renaming the private key file to GOOGLE_APPLICATION_CREDENTIALS and placing it in your home directory is not the correct method for authenticating with the gcloud SDK. This environment variable is used by certain Google Cloud libraries and applications, not the gcloud SDK directly. - **B** is incorrect because the `gcloud auth login` command is designed for interactive user authentication, not for authenticating as a service account using a private key file. - **C** is correct because the `gcloud auth activate-service-account` command is specifically designed to authenticate with Google Cloud services as a service account. By providing the path to the private key file, you can activate the service account for use with gcloud commands, enabling you to perform actions based on the service account's permissions. - **D** is incorrect because simply placing the renamed private key file in the Cloud SDK's installation directory does not activate the service account for gcloud commands. For more information, refer to the [Google Cloud SDK documentation](https://cloud.google.com/sdk/gcloud/reference/auth/activate-service-account) and [authorization guide](https://cloud.google.com/sdk/docs/authorizing).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
At a game development company, your DevOps team has provided a JSON file containing the private key of a service account for local testing of a paid premium game version. This account has access to necessary GCP services. With the gcloud SDK installed on your laptop, how do you authenticate and authorize using the provided private key with gcloud commands?
A
Rename the private key file to GOOGLE_APPLICATION_CREDENTIALS and place it in your home directory.
B
Run the gcloud auth login command and point it to the private key.
C
Run the gcloud auth activate-service-account command and point it to the private key.
D
Rename the private key file to credentials.json and place it in the installation directory of the Cloud SDK.
No comments yet.