如何继承访问权限以查看属于 GCP 组织的所有项目?

How to inherit access to see all projects belonging to a GCP organization?

我目前在 Google 工作区中被列为管理员,但出于某种原因,似乎仍有某些操作我无法执行,例如创建文件夹来组织项目。我们正在使用 terraform 生成一些项目,生成的项目只允许访问直接在权限中指定的项目。

我看到网站上引用了继承的权限/访问权限。我们如何设置它,以便我和其他一些人始终继承访问权限以查看为组织创建的每个项目?

I see inherited permissions / access referenced on the website. How would we set it up so that I, and a few other people always inherit access to see every project that's created for the organization?

权限是继承的。如果您想访问组织中的所有项目,包括未来的项目,请在组织级别授予身份角色。

例如,要授予查看组织中所有文件夹项目的权限,适当的角色是 roles/resourcemanager.organizationViewer。允许身份浏览文件夹、项目和 IAM 策略的下一级是 roles/browser.

为身份授予角色:

gcloud RESOURCE_TYPE add-iam-policy-binding RESOURCE_ID \
  --member=PRINCIPAL_TYPE:ID \
  --role=ROLE_ID
  • RESOURCE_TYPE: 项目、文件夹或组织
  • RESOUOURCE_ID: PROJECT_ID, FOLDER_ID, or ORGANIZATION_ID 匹配 - -
  • PRINCIPAL_TYPE:常用值有serviceAccount、group或user
  • ID:身份的邮箱地址。示例 john@gmail.com
  • ROLE_ID:要授予的角色。示例 roles/resourcemanager.organizationViewer

示例命令:(将 $ORG_ID 替换为组织 ID)

gcloud organizations add-iam-policy-binding $ORG_ID \
  --member=user:john@gmail.com \
  --role=roles/resourcemanager.organizationViewer

Access control for organizations using IAM

您可以使用 Google Cloud Console GUI 并通过 SDK 和 API 完成上述操作。