Following gcloud documentation
gcloud iam service-accounts
add an IAM policy binding to an IAM service account
https://cloud.google.com/sdk/gcloud/reference/iam/service-accounts/add-iam-policy-binding
Example section
To add an IAM policy binding for the role of 'roles/editor' to the service account '[email protected]', run:
gcloud iam service-accounts add-iam-policy-binding \
[email protected] \
--member='serviceAccount:[email protected]' \
--role='roles/editor'
gcloud projects add-iam-policy-binding
add IAM policy binding for a project
https://cloud.google.com/sdk/gcloud/reference/projects/add-iam-policy-binding
Example section
To add an IAM policy binding for the role of 'roles/editor' to the service account '[email protected]', run:
gcloud projects add-iam-policy-binding \
[email protected] \
--member='serviceAccount:[email protected]' \
--role='roles/editor'
gcloud organizations add-iam-policy-binding
add IAM policy binding for an organization
https://cloud.google.com/sdk/gcloud/reference/organizations/add-iam-policy-binding
Example section
To add an IAM policy binding for the role of 'roles/editor' to the service account '[email protected]', run:
gcloud organizations add-iam-policy-binding \
[email protected] \
--member='serviceAccount:[email protected]' \
--role='roles/editor'
Does anyone knows if those 3 commands are actually the same ?
Thanks in advance for your help.
Jonathan.
gcloud projects add-iam-policy-binding [email protected] ...
but that is a wrong parameter. It should be a PROJECT_ID. So, the right command should have beengcloud projects add-iam-policy-binding <PROJECT_ID> ...
By the way, is the output of this 2nd example visible in GCP Console? I can't find it. – Vincent Yin