You need to grant the Editor role to a project member using scripting or automation. Which two methods accomplish this? (Choose two.)
Choose an answer
Tap an option to check your answer.
Correct answer: setIamPolicy() via REST API, gcloud projects add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor.
Why this is the answer
The setIamPolicy() method via REST API is used to set the entire IAM policy for a resource, including adding or removing members and roles. This allows for programmatic management of permissions. Similarly, gcloud projects add-iam-policy-binding is a command-line tool that directly adds an IAM policy binding to a project, granting the specified role to a member. Both methods are suitable for scripting and automation. GetIamPolicy() only retrieves the current policy and does not modify it. gcloud pubsub add-iam-policy-binding is specific to Pub/Sub topics, not projects. Using the GCP Console is a manual process and not suitable for scripting or automation.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed