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, 2022 in GCP by Tejashwini
• 3,820 points
851 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.

Enroll in our Google Cloud Platform Certification program and learn about GCP in detail.

Thanks!

answered Nov 10, 2022 by Ashwini
• 5,430 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
2,517 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,230 points
2,510 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,230 points
4,902 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,230 points
1,562 views
0 votes
1 answer

Understanding GCP IAM between multiple projects

Roles set on one project cannot be ...READ MORE

answered Nov 7, 2022 in GCP by Tejashwini
• 3,820 points
914 views
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, 2022 in GCP by Ashwini
• 5,430 points
244 views
0 votes
2 answers
0 votes
1 answer
+1 vote
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, 2022 in GCP by Ashwini
• 5,430 points

edited Sep 6, 2023 by Khan Sarfaraz 10,708 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