Courseiva
hardMultiple ChoiceObjective-mapped

Combine Organization Policy and IAM Deny Policy to Enforce Service Account Usage

An organization wants to enforce that all Compute Engine instances are created with a specific service account that has only the permissions defined by a custom role. Additionally, users must not be able to override this service account. Which two mechanisms should be combined?

Quick Answer

The correct answer is to combine an Organization Policy with the constraint `constraints/compute.setServiceAccount` and an IAM deny policy that blocks the `iam.serviceAccounts.actAs` permission on all other service accounts. This works because the Organization Policy prevents users from specifying a different service account when creating Compute Engine instances, while the IAM deny policy ensures that even if a user attempts to act as another service account, the permission is explicitly blocked. Together, these mechanisms enforce that only the designated service account can be used and that users cannot override it. On the Google Professional Cloud Security Engineer exam, this scenario tests your understanding of defense-in-depth for service account enforcement—a common trap is relying solely on an Organization Policy without also denying the `actAs` permission, which leaves a bypass open. Remember the memory tip: “Constrain the choice, then deny the act” to recall that the Organization Policy restricts the option, and the IAM deny policy blocks the permission to use any other account.

⚠ Common exam trap

Google Cloud often tests the misconception that a single mechanism (like an organization policy or IAM role restriction) is sufficient, when in reality two complementary controls are needed to both restrict the service account selection and block the actAs permission on unauthorized accounts.

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

An Organization Policy with constraint constraints/compute.setServiceAccount and an IAM deny policy to deny the iam.serviceAccounts.actAs permission on other service accounts.

It combines an Organization Policy constraint (`constraints/compute.setServiceAccount`) that prevents users from specifying a different service account when creating Compute Engine instances, with an IAM deny policy that blocks the `iam.serviceAccounts.actAs` permission on all other service accounts. Together, these enforce that only the designated service account can be used, and users cannot override it.

Answer analysis

Option-by-option breakdown

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

  • Use Cloud Audit Logs to monitor and alert on non-compliant instances.

    Why it's wrong here

    Monitoring does not prevent creation.

  • VPC Service Controls to restrict the service account usage.

    Why it's wrong here

    VPC Service Controls control data exfiltration, not service account enforcement.

  • An Organization Policy with constraint constraints/compute.setServiceAccount and an IAM deny policy to deny the iam.serviceAccounts.actAs permission on other service accounts.

    Why this is correct

    This combination enforces the service account and prevents override.

  • Grant users only the Compute Instance Admin v1 role and remove the actAs permission.

    Why it's wrong here

    Users could still create instances with default service account.

About these practice questions

This PCSE question is part of Courseiva's 960-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way 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. An organization wants to enforce that all Compute Engine instances must use a specific service account. Which three steps are necessary? (Choose three.)

hard
  • A.Create a custom role with compute.instances.create permission.
  • B.Grant the service account the needed roles on the project.
  • C.Create the service account in the project.
  • D.Set an organization policy constraint compute.restrictServiceAccountUsage to allow only that service account.
  • E.Grant the compute.instanceAdmin role to the service account.

Why B: The service account must be granted the necessary IAM roles on the project (or specific resources) to perform its intended actions. Without these grants, even if the service account is enforced, it will lack permissions to interact with Compute Engine resources. This step ensures the service account has the required access, such as compute.instanceAdmin or custom roles, to manage instances.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.