Google Cloud Associate Cloud Engineer — Question 145

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?

Answer options

Correct answer: B

Explanation

The correct command is gcloud auth activate-service-account, which is specifically designed for activating a service account using its private key. The other options are incorrect because gcloud auth login is meant for user accounts, and simply placing the key file in specific locations or renaming it does not authenticate the service account properly.