Question 154 of 500

Quick Answer

The correct answer is to assign a dedicated service account to each Cloud Run service with the necessary Pub/Sub publisher role. This approach enforces least privilege by ensuring that each microservice can only publish to its specific topic and cannot impersonate another service’s identity. Cloud Run automatically rotates the short-lived tokens associated with these per-service service accounts via the metadata server, eliminating manual key rotation. On the Google Professional Cloud Security Engineer exam, this scenario tests your understanding of identity-based access control for serverless workloads, where a common trap is to use a single shared service account with broad permissions. Remember the key principle: one service, one account, one topic. A useful memory tip is “per-service, per-topic, per-role” — each Cloud Run service gets its own identity, scoped to only the Pub/Sub topic it needs, with credentials rotated automatically by the platform.

PCSE Practice Question: Configuring access within a cloud solution environment

This PCSE practice question tests your understanding of configuring access within a cloud solution environment. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

An organization uses Cloud Run to deploy microservices. Each microservice needs to authenticate to Cloud Pub/Sub topics. The Security Engineer wants to enforce that each service only uses its own service account and cannot impersonate others. The team also wants to rotate credentials automatically. What is the best practice to achieve this?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "best"

    Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

Question 1hardmultiple choice
Read the full NAT/PAT explanation →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Assign a dedicated service account to each Cloud Run service with the necessary Pub/Sub publisher role.

Option A is correct because Cloud Run allows you to assign a dedicated, per-service service account at deployment time. By granting each service account only the Pub/Sub publisher role on its specific topic, you enforce least-privilege access and prevent impersonation. Cloud Run automatically rotates the short-lived tokens associated with these service accounts via the metadata server, eliminating the need for manual key management.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Assign a dedicated service account to each Cloud Run service with the necessary Pub/Sub publisher role.

    Why this is correct

    Cloud Run uses the attached service account to obtain short-lived tokens automatically.

    Clue confirmation

    The clue word "best" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Configure each Cloud Run service to use the Compute Engine default service account and rely on the metadata server.

    Why it's wrong here

    Cloud Run does not have a metadata server; it uses the attached service account.

  • Use Workload Identity Federation to map each service to a Google service account.

    Why it's wrong here

    Workload Identity Federation is for external identities, not Cloud Run.

  • Create a service account key for each service and store it in Cloud Secret Manager.

    Why it's wrong here

    Keys are long-lived and require manual rotation.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse the Compute Engine default service account (which is shared and not recommended for production) with the ability to assign dedicated service accounts per Cloud Run service, or they mistakenly think Workload Identity Federation is the correct approach for internal Google Cloud services.

Detailed technical explanation

How to think about this question

Cloud Run uses the Compute Engine metadata server to vend OAuth2 access tokens for the attached service account, which are automatically refreshed and have a default lifetime of 1 hour. The `iam.serviceAccountTokenCreator` role is not needed because Cloud Run directly impersonates the service account via the metadata server's `instance/service-accounts/default/token` endpoint. In a real-world scenario, if a microservice needs to publish to multiple topics, you would grant the `pubsub.publisher` role on each topic to the service account, ensuring that even if one service is compromised, it cannot publish to topics owned by other services.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related PCSE practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free PCSE practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PCSE question test?

Configuring access within a cloud solution environment — This question tests Configuring access within a cloud solution environment — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Assign a dedicated service account to each Cloud Run service with the necessary Pub/Sub publisher role. — Option A is correct because Cloud Run allows you to assign a dedicated, per-service service account at deployment time. By granting each service account only the Pub/Sub publisher role on its specific topic, you enforce least-privilege access and prevent impersonation. Cloud Run automatically rotates the short-lived tokens associated with these service accounts via the metadata server, eliminating the need for manual key management.

What should I do if I get this PCSE question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "best". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more ways this is tested on PCSE

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A developer needs to deploy a Cloud Run service that will read from a Cloud Pub/Sub topic. What is the least privileged IAM role to grant to the Cloud Run service's service account?

easy
  • A.roles/pubsub.subscriber on the topic resource
  • B.roles/pubsub.viewer
  • C.roles/pubsub.subscriber
  • D.roles/pubsub.publisher

Why C: Option C is correct because the Cloud Run service needs only the ability to pull (subscribe to) messages from the Pub/Sub topic. The `roles/pubsub.subscriber` role grants the `pubsub.subscriptions.consume` and `pubsub.subscriptions.get` permissions required to read messages, and when applied at the topic resource level (as implied by the option), it allows the service account to create and manage a subscription on that topic. This is the least privileged role that enables the read operation without granting unnecessary permissions like publishing or viewing all topics.

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCSE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCSE exam.