Courseiva
Configuring Access and SecurityeasyMultiple ChoiceObjective-mapped

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?

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 correct command is 'gcloud projects get-iam-policy my-project --format json'. The 'add-iam-policy-binding' command is for adding bindings, 'set-iam-policy' is for setting from a file, and 'list' is not a valid subcommand for IAM policies.

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 769 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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.