exam questions

Exam Professional Cloud Network Engineer All Questions

View all questions & answers for the Professional Cloud Network Engineer exam

Exam Professional Cloud Network Engineer topic 1 question 30 discussion

Actual exam question from Google's Professional Cloud Network Engineer
Question #: 30
Topic #: 1
[All Professional Cloud Network Engineer Questions]

You have recently been put in charge of managing identity and access management for your organization. You have several projects and want to use scripting and automation wherever possible. You want to grant the editor role to a project member.
Which two methods can you use to accomplish this? (Choose two.)

  • A. GetIamPolicy() via REST API
  • B. setIamPolicy() via REST API
  • C. gcloud pubsub add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor
  • D. gcloud projects add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor
  • E. Enter an email address in the Add members field, and select the desired role from the drop-down menu in the GCP Console.
Show Suggested Answer Hide Answer
Suggested Answer: BD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ESP_SAP
Highly Voted 4 years ago
Correct Answer are (D) & (E) GetIamPolicy and SetIamPolicy is only for service accounts. But question asks for a project members. Hence, D and E are correct ans. D - https://cloud.google.com/iam/docs/granting-changing-revoking-access#granting-gcloud-manual E - https://cloud.google.com/iam/docs/granting-changing-revoking-access#access-control-via-console
upvoted 18 times
Jason_Cloud_at
1 year, 4 months ago
@dzhu is correct , question says should use scripting and automation, so obvious answer is BD
upvoted 3 times
...
dzhu
3 years, 1 month ago
E is not scripting and automation. So E is obviously wrong. The answer should be B and D
upvoted 12 times
...
AzureDP900
1 year, 11 months ago
Yes, D and E are correct
upvoted 1 times
...
...
EranSolstice
Highly Voted 3 years ago
A) GetIamPolicy() would not do anything by itself but see (B) B) would require use of GetIamPolicy() as otherwise SetIamPolicy() override existing binding C) obviously wrong, question is not about pubsub D) the documentation indicate that project_id need to be used not project_name, would therefore return an error E) would work, despite being very vague, but is not automation. Now, the question ask for "which 2 _methods_ can be used to achieve that". Both GetIamPolicy() and SetIamPolicy() are programatic _methods_ that if used together could achieve that. Therefore one could roll with A&B in the spirits of that very tricky question.
upvoted 9 times
BenMS
10 months, 1 week ago
In answer D, "project_name" is the name of a parameter inserted by the programmer. The fact it's a confusing name does not affect its accuracy. I agree B is a correct answer. Therefore I think the correct answers are B & D.
upvoted 1 times
...
nqthien041292
1 year, 2 months ago
Agree with you. A, B will be correct hence D provide wrong parameter regarding Project Name
upvoted 1 times
...
...
saraali
Most Recent 2 months, 2 weeks ago
Selected Answer: BD
The correct options are BD. Reason: B. setIamPolicy() via REST API: You can use the setIamPolicy() method via the REST API to update the IAM policy of a project, granting roles programmatically. This allows automation and scripting, aligning with your goal of minimizing manual management. D. gcloud projects add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor: The gcloud command-line tool is a common method to manage IAM roles for projects. This command allows you to grant the roles/editor role to a user, making it suitable for automation and scripting within a project.
upvoted 2 times
...
thewalker
6 months, 1 week ago
Selected Answer: BD
Both methods can be used to grant the editor role to a project member using scripting and automation. The setIamPolicy() method via REST API can be used to set the IAM policy for a project. The IAM policy is a JSON document that specifies the roles and members that have access to the project. To grant the editor role to a project member, you can use the following JSON document: { "bindings": [ { "role": "roles/editor", "members": [ "user:Susername" ] } ] } The gcloud projects add-iam-policy-binding command can be used to add a binding to the IAM policy for a project. A binding is a pair of a role and a member. To grant the editor role to a project member, you can use the following command: gcloud projects add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor
upvoted 2 times
thewalker
6 months, 1 week ago
The other options are incorrect because: A. GetIamPolicy() via REST API This method can be used to get the IAM policy for a project, but it cannot be used to set the IAM policy. C. gcloud pubsub add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor This command is used to add a binding to the IAM policy for a Pub/Sub topic or subscription, not a project. E. Enter an email address in the Add members field and select the desired role from the drop-down menu in the GCP Console. This method can be used to grant the editor role to a project member, but it is not a scripting or automation method. Therefore, the best options are to use the setIamPolicy() method via REST API or the gcloud projects add-iam-policy-binding command.
upvoted 1 times
...
...
vyomkeshbakshi
7 months, 2 weeks ago
D and B.
upvoted 1 times
...
rick2
11 months, 2 weeks ago
Selected Answer: BD
B) https://cloud.google.com/resource-manager/reference/rest/v1/projects/setIamPolicy D) https://cloud.google.com/sdk/gcloud/reference/projects/add-iam-policy-binding
upvoted 3 times
...
PotatoGCP
1 year ago
Selected Answer: BD
BD are correct. Scripting and Automation!
upvoted 2 times
...
Mo7y
1 year, 4 months ago
Selected Answer: AB
Keywords: scripting and automation + the word "methods" search for the word "method" in the below documentation and see where it's mentioned :) https://cloud.google.com/iam/docs/granting-changing-revoking-access#multiple-roles-programmatic
upvoted 2 times
...
Komal697
1 year, 7 months ago
Selected Answer: DE
Option D is correct because it uses the gcloud command-line tool to add an IAM policy binding to a project. This command adds a new IAM policy binding to a project, granting the specified user the editor role. Option E is correct because it describes the process of using the GCP Console to grant the editor role to a project member. This can be done by entering the member's email address in the Add members field and selecting the editor role from the drop-down menu.
upvoted 2 times
Jason_Cloud_at
1 year, 4 months ago
You should read the question well , It says use scripting and automation , E is a manual process so answer is BD
upvoted 1 times
...
...
Ben756
1 year, 7 months ago
Selected Answer: BD
B & D are correct. B. setIamPolicy() via REST API - This method updates the IAM policy for a resource, such as a project, and allows you to add or modify members and their roles. D. gcloud projects add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor - This method uses the gcloud command-line tool to add an IAM policy binding for a specific project and member. Option A is not sufficient because getIamPolicy() only retrieves the current IAM policy for a resource, but does not allow for modifying it. Option C is not sufficient because it is a command for Pub/Sub, not for managing IAM policies for projects. Option E is not sufficient because it requires manual interaction with the GCP Console, and cannot be easily scripted or automated.
upvoted 3 times
...
Blitzer
1 year, 8 months ago
Selected Answer: BD
I think BD are the correct ones by elimination: A. GetIamPolicy() - read only method and BTW with a typo (should be getIAmPolicy but I guess that's not the intenional mistake) B. setIamPolicy() via REST API - does the job! C. gcloud pubsub add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor - nothing to do because points to pubsub D. gcloud projects add-iam-policy-binding Sprojectname --member user:Susername --role roles/editor - does the job! E. Enter an email address in the Add members field, and select the desired role from the drop-down menu in the GCP Console. - no automation option
upvoted 5 times
...
Melampos
1 year, 9 months ago
Selected Answer: BD
two methods for set permissions
upvoted 3 times
...
pk349
1 year, 9 months ago
A. GetIamPolicy() via REST API B. setIamPolicy() via REST API
upvoted 1 times
...
chelbsik
1 year, 10 months ago
Selected Answer: AB
I go for AB because of EranSolstice explanaition seems correct to me, see https://cloud.google.com/iam/docs/granting-changing-revoking-access#multiple-roles No idea why people vote for E - this is not automation at all.
upvoted 1 times
...
GCP72
2 years, 2 months ago
Selected Answer: DE
I think D&E is correct answer
upvoted 3 times
...
ThisisJohn
3 years ago
I'd vote A and B as @EranSolstice says, because of the following exceprt from here https://cloud.google.com/iam/docs/granting-changing-revoking-access#multiple-roles To make large-scale access changes that involve granting and revoking MULTIPLE roles, use the read-modify-write pattern to update the resource's IAM policy: Reading the current policy by calling getIamPolicy(). Editing the returned policy, either by using a text editor or programmatically, to add or remove any principals or role bindings. Writing the updated policy by calling setIamPolicy().
upvoted 4 times
...
ThisisJohn
3 years ago
I'd vote A and B as @EranSolstice says, because of the following exceprt from here https://cloud.google.com/iam/docs/granting-changing-revoking-access#multiple-roles To make large-scale access changes that involve granting and revoking MULTIPLE roles, use the read-modify-write pattern to update the resource's IAM policy: Reading the current policy by calling getIamPolicy(). Editing the returned policy, either by using a text editor or programmatically, to add or remove any principals or role bindings. Writing the updated policy by calling setIamPolicy().
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago