【问题标题】:Is there a way to find out to which projects a GCP service account has access to?有没有办法找出 GCP 服务帐户可以访问哪些项目?
【发布时间】:2021-11-24 12:09:39
【问题描述】:

看来我不能只写正文中标题中的相同问题。因为它不符合质量标准。

【问题讨论】:

  • 您想知道在哪个项目上授予了服务帐户?如果是这样,那是组织中的其他项目吗?还是完全随机/在您的组织之外?
  • 服务帐号在我们的项目中。一位客户想在他的项目中授予我们的服务帐户权限。但我们不知道他的项目的名称/ID。

标签: google-cloud-platform service-accounts


【解决方案1】:

运行:gcloud projects list --impersonate-service-account=<your-service-account-email-address>

这需要启用云资源管理器 API (cloudresourcemanager.googleapis.com) 并为服务帐户提供 resourcemanager.projects.list 权限。

该标志非常不言自明:它将命令作为给定的服务帐户而不是您配置的凭据运行。

【讨论】:

  • 成功了!谢谢你。首先我收到错误消息:Failed to impersonate <...>. Make sure the account that's trying to impersonate it has access to the service account itself and the "roles/iam.serviceAccountTokenCreator" role. 所以我必须授予自己项目的 serviceAccountTokenCreator IAM 角色和服务帐户的所有者角色。然后它起作用了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-30
  • 2020-08-26
  • 1970-01-01
  • 2021-09-20
相关资源
最近更新 更多