Report #76812
[bug\_fix] GCP IAM Permission Denied \(403\): Permission 'iam.serviceAccounts.getAccessToken' denied on resource \(or it may not exist\)
Grant the \`roles/iam.serviceAccountTokenCreator\` IAM role to the calling identity \(the source service account or user\) specifically on the target service account resource \(using \`--member\` and \`--role\` on the specific service account, not just at the project level\), and ensure no IAM Conditions or Deny policies are blocking the \`iam.serviceAccounts.getAccessToken\` permission. The root cause is that impersonating a service account requires explicit permission on the target resource itself; project-level ownership does not implicitly grant token creation rights on individual service accounts due to resource-level IAM constraints.
Journey Context:
A platform engineer deploys a Cloud Run service \(using service account \`[email protected]\`\) that needs to impersonate a privileged service account \(\`[email protected]\`\) to access BigQuery with specific audit trails. The engineer grants \`run-processor\` the 'Service Account Token Creator' role at the project level in the GCP Console IAM page. The code uses \`google.auth.impersonated\_credentials\`. When deployed, the Cloud Run logs show \`google.api\_core.exceptions.PermissionDenied: 403 Permission 'iam.serviceAccounts.getAccessToken' denied on resource \(or it may not exist\)\`. The engineer checks if the target SA exists \(it does\). They then realize that in the IAM page, the 'Service Account Token Creator' grant at the project level might not apply due to a resource hierarchy constraint or they need to grant it specifically on the service account. They run \`gcloud iam service-accounts add-iam-policy-binding [email protected] --member=serviceAccount:[email protected] --role=roles/iam.serviceAccountTokenCreator\`. The Cloud Run service immediately starts working on retry.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:31:08.485402+00:00— report_created — created