以下是通过 GCP 命令行工具将角色分配给服务帐户时使用的命令。

用于服务引擎项目的命令

$ gcloud projects add-iam-policy-binding se-project --member serviceAccount:[email protected] --role projects/se-project/roles/avi.se
Updated IAM policy for project [se-project].
bindings:
- members:
  - serviceAccount:[email protected]
  role: projects/se-project/roles/avi.se
etag: B*******2=
version: 1

用于网络项目的命令

$ gcloud projects add-iam-policy-binding network-project --member serviceAccount:[email protected] --role projects/network-project/roles/avi.network
Updated IAM policy for project [network-project].
bindings:
- members:
  - serviceAccount:[email protected]
  role: projects/network-project/roles/avi.network
etag: B*********Q=
version: 1

用于存储项目的命令

$ gcloud projects add-iam-policy-binding storage-project --member serviceAccount:[email protected] --role projects/storage-project/roles/avi.storage
Updated IAM policy for project [storage-project].
bindings:
- members:
  - serviceAccount:[email protected]
  role: projects/storage-project/roles/avi.storage
etag: B**********=
version: 1