Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You are deploying an event-driven pipeline where Cloud Storage direct events trigger a private Cloud Run service named media-processor via Eventarc.
Your production environment requires:
How should you configure the IAM roles and service accounts for this architecture?
roles/eventarc.eventReceiver on the project and roles/run.invoker on media-processor. Grant roles/pubsub.publisher to the Cloud Storage service agent, and keep Cloud Run IAM authentication enabled so Cloud Run validates the trigger's OIDC ID token.This configuration establishes end-to-end IAM and OIDC authentication between Cloud Storage, Eventarc, and a private Cloud Run receiver using dedicated identities scoped to the principle of least privilege.
Authorization header with a Google-signed OpenID Connect (OIDC) ID token. Cloud Run validates this token at the platform layer before forwarding any payload to the media-processor container. Eventarc's underlying Pub/Sub push subscription automatically generates and attaches this OIDC token using the trigger's assigned service account.roles/editor) permissions. Binding roles/run.invoker specifically on media-processor ensures the trigger cannot invoke unrelated Cloud Run services in the project.roles/pubsub.publisher to the Cloud Storage service agent (service-PROJECT_NUMBER@gs-project-accounts.iam.gserviceaccount.com) enables Cloud Storage to publish direct event notifications to the underlying Pub/Sub topic. Granting roles/eventarc.eventReceiver on the project allows the trigger identity to receive events from the provider.roles/pubsub.publisher), trigger receipt (roles/eventarc.eventReceiver), and target invocation (roles/run.invoker) are cleanly isolated.constraints/run.requireInvokerIam.Unlike solutions that disable platform authentication or reuse default service accounts, this setup enforces cryptographic OIDC verification at the Cloud Run boundary while restricting every Google-managed agent and user-managed identity to only the permissions required for its role.
media-processor with --no-invoker-iam-check to allow Eventarc requests through the ingress layer, and configure Identity Platform in the application code to validate OIDC ID tokens on incoming requests.Passing the --no-invoker-iam-check flag disables Cloud Run IAM authentication, making the media-processor endpoint publicly accessible to unauthenticated HTTP callers. Identity Platform is a customer identity and access management (CIAM) service designed for authenticating human end users.
media-processor container directly, violating the requirement that Cloud Run reject unauthorized requests before they reach the application.constraints/run.requireInvokerIam explicitly block --no-invoker-iam-check.roles/pubsub.publisher to the Cloud Storage service agent or roles/eventarc.eventReceiver to the trigger identity, causing event delivery to fail.You were building a public-facing web or mobile backend where human end users sign in with Identity Platform and send user ID tokens in Authorization: Bearer headers to a public Cloud Run API.
For event-driven architectures and service-to-service communication, always rely on Cloud Run's built-in IAM Invoker check with Google-signed OIDC tokens rather than disabling IAM and validating tokens manually.
roles/run.invoker on media-processor directly to the Cloud Storage service agent, and grant roles/cloudfunctions.invoker to the media-processor runtime service account so the service can accept HTTP event payloads.This approach grants Cloud Run invocation permissions to the Cloud Storage service agent (gs-project-accounts) and assigns the Cloud Functions Invoker role (roles/cloudfunctions.invoker) to the media-processor service's own runtime service account.
roles/pubsub.publisher, and Eventarc delivers those events to Cloud Run using the trigger's service account.roles/cloudfunctions.invoker only governs 1st-gen Cloud Functions. Cloud Run services (and 2nd-gen Cloud Run functions) enforce access using roles/run.invoker (run.routes.invoke).media-processor's own runtime service account gives the container permission to call itself, not permission for the Eventarc trigger to invoke it.roles/eventarc.eventReceiver.roles/run.invoker controls which upstream callers can invoke the service.An application running inside a Cloud Run service needed to invoke a 1st-gen Cloud Function directly over HTTP, in which case the calling service's runtime service account would need roles/cloudfunctions.invoker on that 1st-gen function.
roles/iam.serviceAccountOpenIdTokenCreator to the media-processor runtime service account, and grant roles/eventarc.serviceAgent to the Cloud Storage service agent.This option reuses the Compute Engine default service account (PROJECT_NUMBER-compute@developer.gserviceaccount.com) as the Eventarc trigger identity, grants roles/iam.serviceAccountOpenIdTokenCreator to the receiving service's runtime identity, and assigns roles/eventarc.serviceAgent to Cloud Storage.
roles/editor) role across the project, making it unsuitable for production workloads.roles/run.invoker on media-processor or roles/eventarc.eventReceiver on the project. Without roles/run.invoker, Eventarc triggers remain active in configuration but fail at runtime with authentication errors.roles/iam.serviceAccountOpenIdTokenCreator to the media-processor runtime service account does nothing to validate incoming requests; that role is for callers impersonating a service account via the IAM Credentials API (generateIdToken). Meanwhile, roles/eventarc.serviceAgent belongs to Google's Eventarc service agent, not Cloud Storage, which instead requires roles/pubsub.publisher.gcp-sa-pubsub) having roles/iam.serviceAccountTokenCreator (granted automatically for newer projects), not roles/iam.serviceAccountOpenIdTokenCreator on the receiver.You were only testing in a sandbox project where the Compute Engine default service account had been granted roles/run.invoker and roles/eventarc.eventReceiver, or if an external caller explicitly needed to impersonate a service account using the IAM Credentials API.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated