GCP Associate Cloud Engineer Practice Question 70: Workload Identity Federation CI/CD

Google Cloud Associate Cloud Engineer · Test 7 · question 10 of 10

Service Accountsmedium

A company runs its build pipeline in GitHub Actions and needs the pipeline to deploy artifacts to a Google Cloud project. Security policy forbids creating or downloading any service account JSON keys, and any credential the pipeline uses must be short-lived. The pipeline currently has no Google Cloud identity of its own.

What should you configure to let the pipeline authenticate to Google Cloud?

Select one answer
Show answer and explanation

Answer:

  • B. Create a workload identity pool with a workload identity provider trusted for GitHub's OIDC tokens, and allow the mapped external identity to impersonate a service account

Workload Identity Federation lets an external workload, such as a GitHub Actions job, an AWS workload, or another identity provider, exchange its own OIDC or SAML token for a short-lived Google Cloud access token, with no service account key ever created or stored. A workload identity pool holds the external identities, and a workload identity provider inside that pool defines how Google Cloud validates GitHub's OIDC tokens (issuer, audience, and attribute mapping/condition). Granting the mapped external identity roles/iam.workloadIdentityUser on a service account lets the pipeline impersonate that service account and receive a token that expires quickly, satisfying both the no-keys and short-lived-credential requirements.

A is exactly what the policy forbids: a downloaded JSON key is a long-lived credential that never expires on its own and is a common source of leaked credentials. C is unrelated; a VPN tunnel provides network connectivity, not authentication, and would not authorize any Google Cloud API call by itself. D grants a standing, overly broad role to every engineer's group instead of a scoped, short-lived credential to the pipeline itself, violating least privilege and leaving a permanent grant in place regardless of whether the pipeline is even running.

Reference: Workload identity federation

Practice Test 7 ›

Study guides for Google Cloud Associate Cloud Engineer