首页 > 解决方案 > 我可以向项目添加组织级 gcp 自定义角色吗?

问题描述

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

$ 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

文档似乎可以解释:

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-platformgcloudgoogle-cloud-iam

解决方案


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


推荐阅读