【问题标题】:Can I add an organization-level gcp Custom Role to a project?我可以向项目添加组织级 gcp 自定义角色吗?
【发布时间】:2020-01-21 20:58:33
【问题描述】:

我正在尝试在 Google Cloud 组织中创建 Custom Role,然后将该组应用于该组织的一个项目。但是,这似乎不起作用:

$ gcloud projects add-iam-policy-binding \
      --member="group:data.viewer@example.com" \ 
      --role="roles/viewer" "my-project"
ERROR: Policy modification failed. For a binding with condition, run "gcloud alpha iam policies lint-condition" to identify issues in condition.
ERROR: (gcloud.projects.add-iam-policy-binding) INVALID_ARGUMENT: Group data.viewer@example.com does not exist.

这是我尝试分配的组织级角色:

$ gcloud iam roles describe data.viewer --organization 1234567
description: Can View Analytics
etag: ...
name: organizations/1234567/roles/data.viewer
stage: ALPHA
title: Data Viewer

documentation 似乎可以解释:

Custom roles can only be used to grant permissions in policies for the same project or organization that owns the roles or resources under them. You cannot grant custom roles from one project or organization on a resource owned by a different project or organization.

这是否意味着我的自定义角色可以不能在该组织内的项目中使用?

我还想知道这是否不是将用户分组并授予他们对各种项目的权限的正确方法。

【问题讨论】:

    标签: google-cloud-platform gcloud google-cloud-iam


    【解决方案1】:

    从上面的错误来看,Group data.viewer@example.com 似乎不存在。 你能确定这个组确实存在并且归同一个组织所有吗?

    【讨论】:

    • 这是我对 Google Groups 的误解。我的思维范式是,作为 usenet / dejanews 后代的“Google 群组”用于托管邮件列表(和别名),而 gcp 权限“群组”则完全不同。显然不是这样的。
    【解决方案2】:

    目前,根据云文档 [1],“您无法在文件夹级别创建自定义角色。自定义角色只能用于为拥有其下的角色或资源的同一项目或组织授予策略权限。您不能从一个项目或组织授予不同项目或组织拥有的资源的自定义角色。”请参阅该页面上的蓝色注释。

    [1]https://cloud.google.com/iam/docs/understanding-custom-roles#basic_concepts

    【讨论】:

    • 我看到了,但我(错误地)解释为该组织内的项目可以使用组织角色。
    【解决方案3】:

    有可能。

    您需要在项目中指定角色为:

    organizations/1234567/roles/data.viewer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-09
      • 2022-07-27
      • 2016-09-24
      • 2020-11-17
      • 1970-01-01
      • 2022-01-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多