
Answer-first summary for fast verification
Answer: Use the command gcloud auth activate-service-account and point it to the private key.
The correct answer is B. The command 'gcloud auth activate-service-account' authorizes access using a service account. This command saves the service account credentials to the local system and sets the specified account as the active account in your Cloud SDK configuration. The other options (A, C, and D) do not provide the correct method for using the service account's private key for authentication and authorization when performing gcloud commands.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You have received a JSON file containing a private key for a Service Account, which you need in order to access several resources in a specified Google Cloud project. After downloading and installing the Cloud SDK, you aim to use this private key for authentication and authorization while executing gcloud commands. What steps should you take to achieve this?
A
Use the command gcloud auth login and point it to the private key.
B
Use the command gcloud auth activate-service-account and point it to the private key.
C
Place the private key file in the installation directory of the Cloud SDK and rename it to 'credentials.json'.
D
Place the private key file in your home directory and rename it to 'GOOGLE_APPLICATION_CREDENTIALS'.