[英]Create project with service account in GCP
How can a project be created in Google cloud with API on a web server?如何使用 Web 服务器上的 API 在 Google Cloud 中创建项目? I came across this documentation to create projects and I want to authenticate using the service account key but I can't give project creation role/permission to create a project.我遇到了这个文档来创建项目,我想使用服务帐户密钥进行身份验证,但我无法授予项目创建角色/权限来创建项目。 I'm using googleapis node js client我正在使用 googleapis 节点 js 客户端
I need to create a Dialogflow agent and for that need to create a GCP project.我需要创建一个 Dialogflow 代理并为此需要创建一个 GCP 项目。
I know this is late but in case anyone else is wondering, I had a similar issue and it's just that service accounts can't create a project without a parent.我知道这已经晚了,但以防万一其他人想知道,我遇到了类似的问题,只是服务帐户无法在没有父项的情况下创建项目。 You can use the sample code from here and then get the attributes needed for resource here .您可以使用示例代码在这里,然后获取所需资源的属性在这里。
const request = {
resource: {
"projectId": "our-project-123",
"name": "my project",
"labels": {
"mylabel": "prod"
},
"parent": {
"type": string,
"id": string
}
},
auth: authClient,
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.