Skip to content

Professional Cloud DevOps Engineer · Domain 2: Building, implementing, and maintaining CI/CD pipelines, including continuous testing, for application, infrastructure, and ML workloads · 30% of the exam

Task 2.3: Managing pipeline configuration and secrets.

Cloud KMS, Secret Manager, Certificate Manager, Parameter Manager and Workload Identity Federation, build-time versus runtime secret injection, and short-lived credentials.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the Google Cloud documentation page that proves it.

Question 1 · choose 1

Cloud Build builds one container image that Cloud Deploy promotes unchanged from dev to staging to prod on Cloud Run. Today a build step passes the database password into the Dockerfile as a build argument. Each environment must use its own password, rotating a password must not need a new build, and the password must not appear in any image layer. How should the password reach the application?

  1. ARead the password from Secret Manager with availableSecrets and pass it to docker build
  2. BCommit the password encrypted with a Cloud KMS key and decrypt it in a build step before the image is built
  3. CReference each environment's Secret Manager secret in that environment's Cloud Run service configuration
  4. DBuild a separate image for each environment from triggers that pass the environment's password as a substitution
Show the answer and why
  • ARead the password from Secret Manager with availableSecrets and pass it to docker build

    Incorrect

    The secret is still injected at build time, so it ends up in the image, the same value is used in every environment, and a rotation needs a new build.

  • BCommit the password encrypted with a Cloud KMS key and decrypt it in a build step before the image is built

    Incorrect

    Encryption protects the value in the repository, but decrypting it during the build still bakes one password into the image for all environments.

  • CReference each environment's Secret Manager secret in that environment's Cloud Run service configuration

    Correct

    Cloud Run exposes a Secret Manager secret to the container at runtime, as a volume or an environment variable, so the image carries no password and each service can use its own secret.

  • DBuild a separate image for each environment from triggers that pass the environment's password as a substitution

    Incorrect

    Per-environment images break the single promoted artifact, and the password is still built into each image.

Build-time injection puts a secret into the artifact; runtime injection keeps the artifact free of secrets and lets each environment supply its own. On Cloud Run, the service configuration references a Secret Manager secret that the runtime service account can access, and the value is resolved when the instance starts (environment variable) or when the file is read (volume).

Question 2 · choose 2

A build must log in to a partner registry with a password kept in Secret Manager. The build's service account can read the secret, but the login step runs with an empty password. The cloudbuild.yaml is: steps: - name: 'gcr.io/cloud-builders/docker' args: ['login', '--username=ci-bot', '--password=$PASSWORD', 'registry.example.com'] availableSecrets: secretManager: - versionName: projects/acme-ci/secrets/partner-pass/versions/latest env: 'PASSWORD' Which TWO changes make the step receive the password? (Choose TWO.)

  1. AMove the availableSecrets block inside the login step, at the same level as args
  2. BReplace $PASSWORD with ${_PASSWORD} and define _PASSWORD as a user substitution on the trigger
  3. CAdd secretEnv: ['PASSWORD'] to the login step
  4. DChange versionName to the secret name alone, without the /versions/latest suffix
  5. EUse entrypoint bash with args ['-c', 'docker login --username=ci-bot --password=$$PASSWORD registry.example.com']
Show the answer and why
  • AMove the availableSecrets block inside the login step, at the same level as args

    Incorrect

    availableSecrets is a top-level field placed after all the build steps; a step only names the secrets it uses.

  • BReplace $PASSWORD with ${_PASSWORD} and define _PASSWORD as a user substitution on the trigger

    Incorrect

    A substitution is a plain trigger value, not a reference to Secret Manager, so the password would sit in the trigger configuration.

  • CAdd secretEnv: ['PASSWORD'] to the login step

    Correct

    The secretEnv field lists which secret environment variables a build step may use.

  • DChange versionName to the secret name alone, without the /versions/latest suffix

    Incorrect

    versionName is the path to a secret version in Secret Manager; dropping the version part does not make the value reach the step.

  • EUse entrypoint bash with args ['-c', 'docker login --username=ci-bot --password=$$PASSWORD registry.example.com']

    Correct

    A secret is referenced through bash in the args field, with the variable prefixed by $$.

Cloud Build exposes Secret Manager secrets through availableSecrets (versionName and env pairs, after the steps). Each step that uses one must list it in secretEnv, run through a bash entrypoint with -c, and refer to it in args with a $$ prefix.

Question 3 · choose 1

A team moves its service settings into Parameter Manager. A version of the parameter checkout-config holds: port: 8080 db_password: __REF__("//secretmanager.googleapis.com/projects/shop-prod/secrets/db-pass/versions/3") The service's runtime service account can read the parameter and already has Secret Manager Secret Accessor on db-pass, yet rendering the version fails because the secret can't be read. What should the team do?

  1. AGrant Secret Manager Secret Accessor on the whole shop-prod project to the service's runtime service account
  2. BChange the reference to versions/latest so that it follows the newest secret version
  3. CGrant Secret Manager Secret Accessor on db-pass to the parameter's own principal identifier
  4. DPut the password value itself in the parameter version and keep the payload format as YAML
Show the answer and why
  • AGrant Secret Manager Secret Accessor on the whole shop-prod project to the service's runtime service account

    Incorrect

    The runtime account already reads the secret; rendering resolves the reference with the parameter's own identity, so a wider grant to the caller changes nothing.

  • BChange the reference to versions/latest so that it follows the newest secret version

    Incorrect

    The version alias decides which value is fetched; the failure is about who may read the secret, not which version it points to.

  • CGrant Secret Manager Secret Accessor on db-pass to the parameter's own principal identifier

    Correct

    Parameters have built-in identities, and a parameter can read a referenced secret only when its principal holds Secret Manager Secret Accessor.

  • DPut the password value itself in the parameter version and keep the payload format as YAML

    Incorrect

    That stores the password as plain configuration instead of in Secret Manager, which defeats the reason for referencing a secret.

Parameter Manager can reference Secret Manager secrets with __REF__() and resolve them when a version is rendered. Because parameters are resources with built-in identities, the parameter's principal needs the Secret Manager Secret Accessor role on each referenced secret.

Question 4 · choose 1

After each production rollout, a pipeline hands a bearer token to the company's own release-audit service, which checks the signature against the public keys Google publishes for the pipeline's service account. The token must carry the release ID as a custom claim and must stop being accepted when the eight-hour soak window ends. Service account keys are forbidden, and the organization policy will not be changed for this. What should the pipeline request from the IAM Service Account Credentials API?

  1. AA self-signed JWT from the signJwt method whose payload holds the release ID and an exp value set eight hours after it is issued
  2. BAn OAuth 2.0 access token from generateAccessToken with a lifetime of 28,800 seconds and the release ID in the request
  3. CA Google-signed OIDC ID token from generateIdToken whose audience is the audit service URL with the release ID appended
  4. DA blob signed with signBlob that contains the release ID and the time the soak window ends, sent as the bearer token
Show the answer and why
  • AA self-signed JWT from the signJwt method whose payload holds the release ID and an exp value set eight hours after it is issued

    Correct

    signJwt signs the caller's own claims with the service account's system-managed key, and the exp claim may be up to 12 hours in the future when the token is not used to call a Google API.

  • BAn OAuth 2.0 access token from generateAccessToken with a lifetime of 28,800 seconds and the release ID in the request

    Incorrect

    Access tokens last at most one hour unless the account is listed in the lifetime extension organization policy constraint, and the request cannot add custom claims.

  • CA Google-signed OIDC ID token from generateIdToken whose audience is the audit service URL with the release ID appended

    Incorrect

    An ID token from generateIdToken is valid for one hour, so it expires long before the soak window ends.

  • DA blob signed with signBlob that contains the release ID and the time the soak window ends, sent as the bearer token

    Incorrect

    A signed blob stays valid until the service account's system-managed key expires, so nothing makes it stop being accepted after eight hours.

The Service Account Credentials API creates several short-lived credential types without keys. Access tokens default to a one-hour maximum (12 hours only with the credential lifetime extension constraint), and ID tokens from generateIdToken are valid for one hour. A self-signed JWT from signJwt can hold any claims the receiving application needs, and its exp claim may be up to 12 hours ahead (at most one hour when it calls a Google API). A signed blob carries no expiry of its own and stays valid until the system-managed key expires.

Question 5 · choose 1

During a migration, both the old platform project and the new platform project need their own Google-managed certificate in Certificate Manager for shop.example.com, issued and renewed automatically and independently of each other, before any traffic moves to the new load balancer. Which domain authorization setup fits?

  1. AA PER_PROJECT_RECORD DNS authorization in each project, with the CNAME record each one returns added to DNS
  2. BA FIXED_RECORD DNS authorization in each project, sharing the single _acme-challenge CNAME record in the zone
  3. CLoad balancer authorization in the new project, so that the certificate is provisioned when traffic arrives
  4. DA self-managed certificate uploaded to both projects, with a reminder to replace it before it expires
Show the answer and why
  • AA PER_PROJECT_RECORD DNS authorization in each project, with the CNAME record each one returns added to DNS

    Correct

    PER_PROJECT_RECORD authorizations let each project issue and manage certificates for the domain independently, and DNS authorization works before the domain points at the load balancer.

  • BA FIXED_RECORD DNS authorization in each project, sharing the single _acme-challenge CNAME record in the zone

    Incorrect

    For managing certificates for the same domain independently across projects, Certificate Manager provides PER_PROJECT_RECORD authorizations; FIXED_RECORD uses one record name for the domain.

  • CLoad balancer authorization in the new project, so that the certificate is provisioned when traffic arrives

    Incorrect

    Load balancer authorization needs the domain to already resolve to the load balancer, which the stem rules out until after the certificate is ready.

  • DA self-managed certificate uploaded to both projects, with a reminder to replace it before it expires

    Incorrect

    Self-managed certificates are not issued or renewed by Google, which the requirement for automatic renewal rules out.

DNS authorizations prove domain ownership for Google-managed certificates and cover one domain name each. To manage certificates for the same domain independently in several projects, use PER_PROJECT_RECORD DNS authorizations; each returns its own CNAME record to add to the DNS zone.

Question 6 · choose 1

An Azure DevOps pipeline must deploy to Google Cloud without service account keys. The team creates a workload identity pool with an OIDC provider for its Microsoft Entra workload identity federation service connection, using: google.subject=assertion.sub Token exchanges fail because the sub claim, of the form PREFIX/sc/SERVICE_CONNECTION, is longer than google.subject allows. Which mapping should the team use?

  1. Agoogle.subject=assertion.sub.substring(0, 127), so that the value fits the permitted length
  2. Bgoogle.subject=assertion.aud, because the audience value is shorter and stable for the pool
  3. Cgoogle.subject=assertion.sub.split('/sc/')[1], so that the service connection identifies the caller
  4. DA workforce identity pool for the Entra tenant instead, keeping the same mapping of assertion.sub as before
Show the answer and why
  • Agoogle.subject=assertion.sub.substring(0, 127), so that the value fits the permitted length

    Incorrect

    The first 127 characters are the long prefix, not the part that identifies the service connection, so the subject would not identify the pipeline.

  • Bgoogle.subject=assertion.aud, because the audience value is shorter and stable for the pool

    Incorrect

    The audience names the provider the token was issued for; it does not identify the service connection that the team wants to grant roles to.

  • Cgoogle.subject=assertion.sub.split('/sc/')[1], so that the service connection identifies the caller

    Correct

    This keeps the part of sub after /sc/, which uniquely identifies the service connection and stays within the 127-character limit.

  • DA workforce identity pool for the Entra tenant instead, keeping the same mapping of assertion.sub as before

    Incorrect

    Workforce identity pools federate human users; pipelines use workload identity pools, and the length limit for google.subject still applies.

google.subject may hold at most 127 characters. The Azure DevOps ID token's sub claim has the form PREFIX/sc/SERVICE_CONNECTION and exceeds that limit, so Google documents the mapping google.subject=assertion.sub.split('/sc/')[1]. Roles are then granted to the subject value that follows /sc/.

Question 7 · choose 1

A release pipeline signs each build manifest with an asymmetric Cloud KMS signing key. A new pipeline step calls the API with this key name and fails: projects/sec-keys/locations/global/keyRings/release/cryptoKeys/manifest-signer The key has two enabled versions. What should the team change?

  1. ASet version 2 as the key's primary version, so that calls with the key name use it by default
  2. BDisable version 1, so that the key has exactly one enabled version for Cloud KMS to choose
  3. CRecreate the key in a regional location, because global keys cannot be used for asymmetric signing
  4. DCall the key with its full version name, ending in cryptoKeyVersions/2 for the current signing version
Show the answer and why
  • ASet version 2 as the key's primary version, so that calls with the key name use it by default

    Incorrect

    Only symmetric encryption keys have a primary version; asymmetric keys have none to set.

  • BDisable version 1, so that the key has exactly one enabled version for Cloud KMS to choose

    Incorrect

    Asymmetric keys still need the version named in each request, and verifiers of older signatures may need version 1.

  • CRecreate the key in a regional location, because global keys cannot be used for asymmetric signing

    Incorrect

    The location is not the problem; the request does not name the key version that an asymmetric key requires.

  • DCall the key with its full version name, ending in cryptoKeyVersions/2 for the current signing version

    Correct

    Asymmetric keys have no primary version, so every use must specify the key version.

Symmetric encryption keys have a primary version that Cloud KMS uses when a request names only the key. Asymmetric keys have no primary version: signing and other operations must name the key version, and any enabled version can be used. Rotating a key creates a new version with its own number.

Question 8 · choose 1

A service runs in europe-west1 and us-east1, and each region connects to its own regional database. The team wants the connection settings kept as versioned YAML configuration that stays within the location where it is used and that each deployment reads at startup, without rebuilding images. How should it store the settings?

  1. AOne global parameter in Parameter Manager holding both regional settings, read through the standard endpoint
  2. BA regional parameter in each location in Parameter Manager, read through each location's regional endpoint
  3. COne file per region baked into the container image during the build, chosen by a location flag at startup
  4. DA global Secret Manager secret with automatic replication, holding the YAML for both regions as one value
Show the answer and why
  • AOne global parameter in Parameter Manager holding both regional settings, read through the standard endpoint

    Incorrect

    Global parameters are stored centrally; they suit settings that apply wherever the service runs, not values that must stay in one location.

  • BA regional parameter in each location in Parameter Manager, read through each location's regional endpoint

    Correct

    Regional parameters are stored within a specific location and accessed through that location's regional endpoint, which fits values such as a regional database's connection string.

  • COne file per region baked into the container image during the build, chosen by a location flag at startup

    Incorrect

    Build-time injection means every settings change needs a new image, which the team wants to avoid.

  • DA global Secret Manager secret with automatic replication, holding the YAML for both regions as one value

    Incorrect

    A secret with automatic replication is not kept within one location, and the settings are not secrets that need Secret Manager.

Parameter Manager stores configuration such as YAML or JSON as versioned parameters. Global parameters are stored centrally and read through the standard API endpoint; regional parameters stay within one location and are read through its regional endpoint, which suits per-region values such as a regional database's connection string.

Practice domain 2 →Practice all domains →