Google ACE Configuring Access and Security Practice Question
You need to add an IAM binding for a user to a project using the gcloud command. Which command should you use?
⚠ Common exam trap
The trap is mixing up commands for different resource types (project vs. service account) and confusing IAM binding commands with role update commands.
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 add-iam-policy-binding
The correct command to add an IAM binding for a user to a project is gcloud projects add-iam-policy-binding, which modifies the project's IAM policy by granting a role to a member. This command is the standard way to manage project-level IAM bindings using gcloud. It requires the project ID, the member (user, group, or service account), and the role.
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
Why this is correct
gcloud projects add-iam-policy-binding PROJECT_ID --member=user:email@example.com --role=roles/viewer is the correct command because it performs an additive update to the project's IAM policy. It reads the current policy, appends the new binding (role + member) to the existing set, and writes the merged policy back atomically, leaving all other bindings untouched. This is the standard CLI operation for granting a specific role to a user at the project scope.
- ✗
gcloud iam service-accounts add-iam-policy-binding
Why it's wrong here
gcloud iam service-accounts add-iam-policy-binding operates on the IAM policy attached to a service account resource, not the project. If you run it, you are granting permissions on that service account (e.g., roles/iam.serviceAccountUser or roles/iam.serviceAccountAdmin) to a principal, which is a different object entirely. To add a binding to the project, the target resource must be the project, identified by a project ID or number, not a service account email. Therefore, it does not achieve the goal of adding a binding to a project's IAM policy.
- ✗
gcloud projects set-iam-policy
Why it's wrong here
gcloud projects set-iam-policy replaces the entire IAM policy for the project with the policy supplied in a JSON or YAML file via the --policy-file flag. Because it is a full overwrite, invoking it to add a single binding without including the current bindings would delete all existing grants and could cause an accidental service outage or lockout. The correct approach is to use an additive command like add-iam-policy-binding; set-iam-policy is intended for complete policy management, such as during infrastructure-as-code deployments where you know the full desired state.
- ✗
gcloud iam roles update
Why it's wrong here
gcloud iam roles update modifies the definition of a custom role, such as roles/my.customRole, by changing its included permissions, title, or description. This command does not touch any resource's IAM policy, so it cannot grant a role to a user on a project. Bindings are separate from role definitions; a role must already exist with the desired permissions, and then you bind that role to members on a specific resource. Thus, this command is irrelevant to the task of adding an IAM binding to a project.
Go deeper
Related to this question
Learn chapter
Security Command Center (SCC)
Key term
Service
A service is a software component or system that performs a specific function and is available to be used by other programs or users over a network.
Key term
Service account
A service account is a special type of account used by an application or a virtual machine, rather than a human user, to authenticate and interact with cloud services and APIs securely.
About these practice questions
Courseiva writes every ACE question from scratch — 775 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.