GCP - how to add a Google account as an IAM principal to a project

0 votes

How do I add a Google account (email) to a GCP project? What GCP SDK command should I use?

It is possible from the UI.

enter image description here

However, neither the gcloud iam command nor the gcloud projects have a choice.

Nov 10 in GCP by Tejashwini
• 2,860 points
30 views

1 answer to this question.

0 votes

I post this community wiki answer to make the solution provided in the comment section more visible. Feel free to edit or expand.

As it was suggested by @Joachim Isaksson in the comment section, you should use the command gcloud projects add-iam-policy-binding:

Adds a policy binding to the IAM policy of a project, given a project ID and the binding. One binding consists of a member, a role, and an optional condition.

To add an IAM policy binding for the role of 'roles/editor' for the user 'test-user@gmail.com' on a project with identifier 'example-project-id-1', run:

gcloud projects add-iam-policy-binding example-project-id-1 --member='user:test-user@gmail.com' --role='roles/editor'

More information you can find in the documentation.

In addition, please have a look at the document Understanding policies.

A principal, also known as a member or identity, which can be a user account, service account, Google group, or domain.

So, the principal should exist, but you can use already existing accounts like Google Account or Google Workspace account.

answered Nov 10 by Ashwini
• 2,760 points

Related Questions In GCP

0 votes
1 answer

How to delete a project from Google Cloud Console

First of all, select the project you ...READ MORE

answered Apr 18, 2018 in GCP by kurt_cobain
• 9,390 points
1,991 views
0 votes
1 answer

How do I create a Google Cloud Platform (GCP) account?

In order to access the services provided ...READ MORE

answered Sep 20, 2019 in GCP by Sirajul
• 59,190 points
2,112 views
0 votes
1 answer

Connect to an instance as a root user in GCP

If you configured an instance to allow ...READ MORE

answered Sep 24, 2019 in GCP by Sirajul
• 59,190 points
3,545 views
0 votes
1 answer

How to add a PTR record to my VM instance on gcp?

If your VM instance uses the primary ...READ MORE

answered Sep 26, 2019 in GCP by Sirajul
• 59,190 points
1,124 views
0 votes
1 answer
0 votes
0 answers

GCP - how to add a Google account as an IAM principal to a project?

How do I add a Google account ...READ MORE

Nov 9 in GCP by Ashwini
• 2,760 points
30 views
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

In GCP, how to list all the resources running under project?

For a specific organization, folder, or project, ...READ MORE

answered Nov 10 in GCP by Ashwini
• 2,760 points
96 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP