easyMultiple ChoiceObjective-mapped
Google ACE Practice Question: A developer wants to verify which IAM roles they…
A developer wants to verify which IAM roles they currently have on a specific GCP project before requesting additional access. Which gcloud command lists the IAM policy for a project?
⚠ Common exam trap
Google Cloud often tests the distinction between listing roles (available role definitions) and getting the IAM policy (actual role bindings), so candidates mistakenly choose `gcloud iam roles list` thinking it shows their assigned roles.
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 [PROJECT_ID]
The correct command to retrieve the IAM policy for a GCP project is `gcloud projects get-iam-policy [PROJECT_ID]`. This command returns the complete IAM policy bindings (roles and members) for the specified project, allowing the developer to see which roles they currently have. It directly queries the Cloud Resource Manager API to fetch the project-level IAM policy.
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 iam roles list --project=[PROJECT_ID]
Why it's wrong here
`gcloud iam roles list --project=[PROJECT_ID]` enumerates the role definitions that exist in the project — both predefined roles (e.g., roles/compute.admin) and any custom roles you created — but it does not inspect the project's IAM policy. Each listed entry shows metadata like role ID, title, permissions, and stage, not the principals (users, groups, or service accounts) that are assigned to the role. Therefore, this command cannot tell you who has which role on the project.
- ✓
gcloud projects get-iam-policy [PROJECT_ID]
Why this is correct
`gcloud projects get-iam-policy [PROJECT_ID]` fetches the complete IAM policy object for the specified project, which is structured as a list of bindings where each binding maps one role to a set of members. The output includes the policy version, etag, and bindings, so you can see exactly which members are assigned each role (e.g., serviceAccount:..., user:...). This is the direct, correct way to query current member-role bindings on a project.
- ✗
gcloud auth list --project=[PROJECT_ID]
Why it's wrong here
`gcloud auth list --project=[PROJECT_ID]` is used to display the accounts that are currently authenticated on your local gcloud SDK, such as your personal Google account or a service account key that has been activated, along with an ACTIVE indicator for the current credential. It performs no API call to Cloud IAM and returns no information about the project's policy or its members; the `--project` flag is not relevant to this local credential listing. Thus, it cannot reveal how roles are bound in the project.
- ✗
gcloud iam service-accounts get-iam-policy [PROJECT_ID]
Why it's wrong here
`gcloud iam service-accounts get-iam-policy [PROJECT_ID]` is incorrectly scoped because this command expects a service account resource identifier (email or ID) as its positional argument, not a project ID, and it returns the IAM policy of that specific service account (e.g., who can use or manage that service account). The project ID passed here would be treated as a non-existent service account, and even if a valid service account were supplied, the output would be a resource-level policy, not the project-level member-role bindings.
Go deeper
Related to this question
Learn chapter
Google Cloud Platform Overview
Key term
IAM policy
An IAM policy is a set of rules that determines who can access specific cloud resources and what actions they are allowed to perform.
Key term
IAM
Identity and Access Management (IAM) is a framework of policies and technologies that ensures the right individuals have the appropriate access to technology resources.
About these practice questions
This ACE question is part of Courseiva's 769-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 →
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.