Courseiva

Google ACE Configuring Access and Security Practice Question

You need to view the current IAM policy for a project named 'my-project' in JSON format. Which command should you use?

⚠ Common exam trap

Many exam-takers confuse read verbs (`get-iam-policy`) with write verbs (`add-iam-policy-binding`, `set-iam-policy`) — candidates often pick the command they've used most recently for granting access rather than the one that retrieves the policy.

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

✓

gcloud projects get-iam-policy my-project --format json

The `gcloud projects get-iam-policy` command retrieves the existing IAM policy bindings for a project and returns them in the requested format. Adding `--format json` outputs the policy as a JSON document, which is exactly what is needed to view the current policy. This is a read-only operation that does not modify any bindings.

Answer analysis

Option-by-option breakdown

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

  • ✗

    gcloud projects add-iam-policy-binding my-project --format json

    Why it's wrong here

    The `gcloud projects add-iam-policy-binding` command is used to modify an existing IAM policy by adding a new binding (a principal, role, and optional condition). It is not a read-only operation; it requires you to specify the project, member, and role as arguments. The `--format json` flag only controls how the command's output is displayed after the mutation occurs, not the operation itself, so it cannot be used to view the current policy.

  • ✓

    gcloud projects get-iam-policy my-project --format json

    Why this is correct

    `gcloud projects get-iam-policy my-project --format json` is the correct command for viewing the current IAM policy of a project. It retrieves the full policy, including all role bindings, conditions, and the etag, and returns it in a structured JSON format. The `--format json` flag ensures the output is machine-readable, which is useful for auditing, scripting, or feeding into other tools like `jq`. This command performs no mutation and is the standard way to inspect IAM policy state.

  • ✗

    gcloud iam service-accounts list --project my-project

    Why it's wrong here

    `gcloud iam service-accounts list --project my-project` lists the service accounts that exist within a project, showing their email addresses, display names, and disabled status. It does not display the project's IAM policy, which describes who has what roles on the project itself. Service accounts are IAM principals (identities) or resources, but this command does not enumerate role bindings or permissions. It serves a completely different purpose: discovering service accounts, not inspecting IAM policy assignments.

  • ✗

    gcloud projects set-iam-policy my-project policy.json

    Why it's wrong here

    `gcloud projects set-iam-policy my-project policy.json` is used to replace the entire IAM policy of a project with the contents of a policy file. This is a write operation that overwrites the existing policy and requires the file to contain a valid policy with an etag (or it may fail based on concurrency rules). It is not a viewing operation; running it would change the policy, potentially removing existing bindings if they are not present in the JSON file. Therefore, it is inappropriate for the task of viewing the current IAM policy.

About these practice questions

One of 775 original ACE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Google Cloud exam blueprint

This ACE 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 ACE exam.