GCP - 如何将 Google 帐户作为 IAM 委托人添加到项目
GCP - how to add a Google account as an IAM principal to a project
使用哪个 GCP SDK 命令将 Google 帐户(电子邮件)添加到 GCP 项目?
从UI开始,是可以的。
然而,gcloud iam command nor gcloud projects没有选择。
我 post 这个社区 wiki 的回答是为了让评论部分提供的解决方案更加明显。随意编辑或扩展。
正如评论区@Joachim Isaksson所建议的那样,您应该使用命令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'
您可以在 documentation 找到更多信息。
另外,请看文档Understanding policies。
A principal, also known as a member or identity, which can be a user account, service account, Google group, or domain.
因此,主体应该存在,但您可以使用已经存在的帐户,例如 Google 帐户或 Google Workspace 帐户。
使用哪个 GCP SDK 命令将 Google 帐户(电子邮件)添加到 GCP 项目?
从UI开始,是可以的。
然而,gcloud iam command nor gcloud projects没有选择。
我 post 这个社区 wiki 的回答是为了让评论部分提供的解决方案更加明显。随意编辑或扩展。
正如评论区@Joachim Isaksson所建议的那样,您应该使用命令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'
您可以在 documentation 找到更多信息。
另外,请看文档Understanding policies。
A principal, also known as a member or identity, which can be a user account, service account, Google group, or domain.
因此,主体应该存在,但您可以使用已经存在的帐户,例如 Google 帐户或 Google Workspace 帐户。