Jan*_*auw 5 google-compute-engine service-accounts gcloud
我想知道是否可以将my-project-a中创建的服务帐户附加到my-project-b中的 Google Compute Engine 实例?
以下命令:
gcloud beta compute instances create my-instance \
--service-account=my-service-account@my-project-a.iam.gserviceaccount.com \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--project=my-project-b
Run Code Online (Sandbox Code Playgroud)
给我以下错误:
(gcloud.beta.compute.instances.create) Could not fetch resource:
- The user does not have access to service account 'my-service-account@my-project-a.iam.gserviceaccount.com'. User: 'me@mysite.com'. Ask a project owner to grant you the iam.serviceAccountUser role on the service account. me@mysite.com is my account and I'm the owner of the org.
Run Code Online (Sandbox Code Playgroud)
不确定这是否相关,但查看 UI(在my-project-b中),没有选项可以从任何其他项目添加服务帐户。我希望能够添加帐户my-service-account@my-project-a.iam.gserviceaccount.com
您可以按照以下步骤对 my-project-a 中的服务帐户进行身份验证到 my-project-b 中的实例:
运行以下命令激活服务帐户:
gcloud auth activate-service-account --key-file=YOUR_JSON_FILE
使用以下命令进行验证:
gcloud 身份验证列表
| 归档时间: |
|
| 查看次数: |
1819 次 |
| 最近记录: |