GCP Professional Cloud Architect Practice Question

Your team delivers a Go microservice that uses Google Cloud client libraries for BigQuery and Pub/Sub. The same container image must run in three locations:

  • Developers' laptops during local integration tests
  • A Cloud Build continuous-integration job
  • A production Cloud Run service in the europe-west1 region
    The service code must obtain credentials automatically in every environment without any code changes or long-lived key files baked into the image. What should you do?
  • Store an OAuth 2.0 client ID and secret in Secret Manager; have the container retrieve them at startup and perform a three-legged OAuth web flow to obtain access tokens.

  • Use Application Default Credentials everywhere: instruct developers to run "gcloud auth application-default login", configure Cloud Build to run with its default service account, and assign a dedicated IAM service account to the Cloud Run service. Rely on the client libraries to obtain tokens from each environment's metadata server or well-known file.

  • Require developers and Cloud Build to pass a user access token as a command-line flag at runtime, and configure the Cloud Run service with the run.invoker IAM role only.

  • Embed a JSON key for a single service account inside the container and set the GOOGLE_APPLICATION_CREDENTIALS environment variable to that path in all three environments.

GCP Professional Cloud Architect
Managing implementation
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot