【发布时间】:2020-10-27 17:17:05
【问题描述】:
我正在使用以下 python 方法创建 gcp 实例:
compute.instances().insert(project=project, zone=zonee, body=config).execute()
在配置变量中,我添加了 serviceAccount 部分:
"serviceAccounts": [
{
"email": SA-email,
"scopes": [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring.write",
"https://www.googleapis.com/auth/service.management.readonly",
"https://www.googleapis.com/auth/servicecontrol"
"https://www.googleapis.com/auth/trace.append",
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/cloud-platform"
]
}
]
我不确定我应该为这个 SA 电子邮件分配什么角色。如果我提到访问范围,是否意味着必须将这些角色分配给 SA 电子邮件?
当我运行上面的代码时。实例创建失败。
我对 SA、角色和范围感到很困惑。
我应该检查什么属性来解决上述问题。
【问题讨论】:
-
请在您获得授权的地方出示您的代码。 OAuth(范围)和服务帐户(角色)之间存在差异。正确答案取决于您使用的授权类型。
-
同意约翰·汉利。
标签: google-cloud-platform google-iam