我已经从 GCP 控制台创建了一个 ServiceAccount
和一个自定义角色。
然而,当尝试关联它们时,失败如下:
gcloud projects add-iam-policy-binding my-project \
--member serviceAccount:cloudrun-poc@my-project.iam.gserviceaccount.com \
--role roles/MyCustomRole
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: Role roles/ClusterUpscaler is not supported for this resource.
有什么想法吗?
最佳答案
您可能需要 create角色 MyCustomRole
在尝试分配它之前。不知道它提示角色 ClusterUpscaler
是什么,但该项目中可能没有集群......此外,自定义角色通常具有类似的名称 projects/{project-id}/roles/{角色名称}
。它们也可以被列出:
gcloud iam list-grantable-roles //cloudresourcemanager.googleapis.com/projects/PROJECT_ID
关于google-cloud-platform - GCP IAM : Binding role to Service Account fails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58086499/