ASSOCIATE-CLOUD-ENGINEER practice question 24 of 35
You received a JSON file that contained a private key of a Service Account in order to get access to several resources in a Google Cloud project. You downloaded and installed the Cloud SDK and want to use this private key for authentication and authorization when performing gcloud commands. What should you do?
Full set: 332 questionsThe gcloud auth activate-service-account command is the designated method within the Cloud SDK to authenticate using a service account's private key file. This command takes the path to the JSON key file and sets the active account for all subsequent gcloud commands to be that service account. This directly addresses the user's need to use the provided private key for authentication and authorization when performing gcloud commands.
A. gcloud auth login is used to authorize a human user account via a web-based OAuth 2.0 flow, not to activate a service account using a key file.
C. Placing a key file in the Cloud SDK installation directory with a specific name is not a recognized or documented procedure for authenticating the gcloud tool.
D. Setting the GOOGLEAPPLICATIONCREDENTIALS environment variable is primarily for Application Default Credentials (ADC) used by client libraries, not for configuring the active account for the gcloud CLI tool itself.
1. Google Cloud Documentation
gcloud auth activate-service-account: "Authorizes access to Google Cloud with a service account. This command is an alternative to gcloud auth login when you want to authenticate as a service account instead of a user account." (Reference: gcloud auth activate-service-account command reference page).
2. Google Cloud Documentation
Authorizing the Cloud SDK: "To authorize with a service account
use the gcloud auth activate-service-account command... This is useful for running gcloud CLI in a virtual machine." (Reference: "Authorizing the Cloud SDK" documentation
section "Authorizing with a service account").
3. Google Cloud Documentation
gcloud auth login: "Authorizes user accounts to access Google Cloud. The gcloud auth login command is used to obtain and place access credentials for a user account on the local system." (Reference: gcloud auth login command reference page).
4. Google Cloud Documentation
Authenticating as a service account: "To provide credentials to a client library or a tool like Terraform
you set the GOOGLEAPPLICATIONCREDENTIALS environment variable... The gcloud CLI does not use this environment variable to find your credentials." (Reference: "Authentication at Google" documentation
section "Authenticating as a service account").
Keep practicing
Take the free ASSOCIATE-CLOUD-ENGINEER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other ASSOCIATE-CLOUD-ENGINEER practice questions
- Question 1You need to verify that a Google Cloud Platform service account was created at a particul…
- Question 2You are building a new version of an application hosted in an App Engine environment. You…
- Question 3You need to create a new billing account and then link it with an existing Google Cloud P…
- Question 4You want to configure 10 Compute Engine instances for availability when maintenance occur…
- Question 5You need to create a custom VPC with a single subnet. The subnet’s range must be as large…
- Question 6You significantly changed a complex Deployment Manager template and want to confirm that …
