Google Cloud Engineer interview question · Most asked

What are service accounts, and how should workloads authenticate without service account keys?

How you'd do it Asked in Cloud Engineer interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

A service account is an identity for a workload rather than a person. Workloads on Google Cloud get short-lived credentials automatically by attaching a service account (Compute Engine, Cloud Run, Cloud Run functions) or through Workload Identity Federation for GKE. Workloads outside Google Cloud (GitHub Actions, AWS, on-premises) use Workload Identity Federation to exchange their own tokens for short-lived Google credentials. Downloaded JSON keys are long-lived secrets and should be avoided.

Longer Answer

  • New organisations enforce the org policy iam.disableServiceAccountKeyCreation by default; keep it on.
  • One service account per workload, with only the roles it needs; don't reuse the Compute Engine default service account (it historically had Editor).
  • Impersonation (roles/iam.serviceAccountTokenCreator, gcloud --impersonate-service-account) lets engineers act as a service account temporarily without keys.
  • Federation for CI: scope the workload identity pool provider to the exact repository and branch with an attribute condition.

Key Points

  • Attach service accounts to workloads.
  • Workload Identity Federation for GKE and external workloads.
  • Avoid JSON keys; block their creation.
  • One account per workload; impersonation for humans.

Explanation

What interviewers look for

Keyless authentication everywhere, and scoping federation tightly.

More Google Cloud Engineer questions

← All Google Cloud Engineer questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake