Google Cloud Associate Cloud Engineer — Question 300

You are writing a shell script that includes a few gcloud CLI commands to access some Google Cloud resources. You want to test the script in your local development environment with a service account in the most secure way. What should you do?

Answer options

Correct answer: B

Explanation

The correct answer is B, as enabling service account impersonation allows you to use the permissions of the service account without exposing its key, which is a more secure approach. Option A involves generating an ID token, which may not be necessary for testing in this context. Option C is less secure since it requires handling the service account key file directly, and option D also involves using a key file to generate an access token, which poses security risks.