Topic 1 Question 170
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?
Use the command gcloud auth login and point it to the private key.
Use the command gcloud auth activate-service-account and point it to the private key.
Place the private key file in the installation directory of the Cloud SDK and rename it to ג€credentials.jsonג€.
Place the private key file in your home directory and rename it to ג€GOOGLE_APPLICATION_CREDENTIALSג€.
解説
ユーザの投票
コメント(11)
B. Use the command gcloud auth activate-service-account and point it to the private key.
Authorizing with a service account gcloud auth activate-service-account authorizes access using a service account. As with gcloud init and gcloud auth login, this command saves the service account credentials to the local system on successful completion and sets the specified account as the active account in your Cloud SDK configuration.
https://cloud.google.com/sdk/docs/authorizing#authorizing_with_a_service_account
👍 41GCP_Student12021/03/14B. gcloud auth activate-service-account --help
NAME) gcloud auth activate-service-account - authorize access to Google Cloud Platform with a service account
SYNOPSIS gcloud auth activate-service-account [ACCOUNT] --key-file=KEY_FILE [--password-file=PASSWORD_FILE | --prompt-for-password] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION To allow gcloud (and other tools in Cloud SDK) to use service account credentials to make requests, use this command to import these credentials from a file that contains a private authorization key, and activate them for use in gcloud. gcloud auth activate-service-account serves the same function as gcloud auth login but uses a service account rather than Google user credentials.
👍 19TAvenger2021/03/14Ans : B gcloud auth activate-service-account --key-file=/test-service-account.json
👍 11ravixkumar2021/03/11
シャッフルモード