Google compute engine 了解gcloud计算实例的服务帐户与作用域

Google compute engine 了解gcloud计算实例的服务帐户与作用域,google-compute-engine,google-api-nodejs-client,Google Compute Engine,Google Api Nodejs Client,我已经创建了一个gcloud计算实例,我想在其中使用storage.objects.get和firebasedatabase.instances.update作用域在同一个项目中执行操作 每个实例都是使用计算引擎默认服务帐户编号创建的-compute@developer.gserviceaccount.com在项目中具有编辑器角色。因此,我假设在使用初始化时,该实例将具有所需的权限 admin.initializeApp({ 凭据:admin.credential.applicationDefa

我已经创建了一个gcloud计算实例,我想在其中使用
storage.objects.get
firebasedatabase.instances.update
作用域在同一个项目中执行操作

每个实例都是使用计算引擎默认服务帐户
编号创建的-compute@developer.gserviceaccount.com
在项目中具有
编辑器
角色。因此,我假设在使用初始化时,该实例将具有所需的权限

admin.initializeApp({
凭据:admin.credential.applicationDefault()
});
但是,请求firestore实例会导致错误
请求的身份验证范围不足

现在我注意到,如果我
gcloud compute实例描述我的实例

“服务帐户”:[
{
“电子邮件”:“数字”-compute@developer.gserviceaccount.com",
“范围”:[
"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/pubsub",
"https://www.googleapis.com/auth/service.management.readonly",
"https://www.googleapis.com/auth/servicecontrol",
"https://www.googleapis.com/auth/trace.append"
]
}
]
服务帐户电子邮件与预定义范围之间有什么关系?实例是否未应用服务帐户的所有作用域


即使我想调整我的作用域,我也需要一些帮助来翻译
storage.objects.get
firebasedatabase.instances.update
iam定义到
https://www.googleapis.com/auth/scope
格式。(
https://www.googleapis.com/auth/firebasedatabase.instances.update
不存在)

所有者、编辑和查看者等角色是我们所称的基本角色[1],它们不包含GCP中每个资源的权限。我建议创建具有所需权限的自定义角色,或选择适当的预定义角色[2]

[1]

[2]