我正在一个Google Cloud项目中处理一系列Cloud Functions,由于某种原因,我突然收到此错误:
Deployment failure:
Missing necessary permission resourcemanager.projects.getIamPolicy for [email protected] on resource projects/la-cloud-functions. Please grant [email protected] the Cloud Functions Service Agent role. You can do that by running 'gcloud iam service-accounts add-iam-policy-binding projects/la-cloud-functions --member=service-1092904037961@gcf-admin-robot.iam.gserviceaccount.com --role=Cloud Functions Service Agent'
当我尝试运行修订的命令时,除了格式错误的错误响应(您不能拥有--role=Cloud Functions Service Agent
-应该是--role=roles/cloudfunctions.serviceAgent
)之外,还包括:
gcloud iam service-accounts add-iam-policy-binding projects/la-cloud-functions --member=service-1092904037961@gcf-admin-robot.iam.gserviceaccount.com --role=roles/cloudfunctions.serviceAgent
我收到此错误:
The requested URL <code>/v1/projects/la-cloud-functions/serviceAccounts/projects/la-cloud-functions:getIamPolicy?alt=json</code> was not found on this server.
最后,尝试通过控制台分配Cloud Functions Server Agent角色给了我另一个惊喜-该角色从列表中丢失了,应该在服务管理下:
我尝试通过使用以下命令重新启用Cloud Functions API来重置服务帐户:
gcloud services enable cloudfunctions.googleapis.com
但同样,没有成功。
任何人都对如何解决此问题并使Cloud Functions Service Agent角色再次可用有任何想法?
TIA-乔
请尝试以下步骤解决此问题:
禁用云功能API:
gcloud services disable cloudfunctions.googleapis.com --project la-cloud-functions
等待约一分钟,以完成禁用。
使用CLI或IAM下的GCP控制台删除云功能成员帐户。
gcloud projects remove-iam-policy-binding la-cloud-functions --member="serviceAccount:[email protected]" --role="roles/cloudfunctions.serviceAgent"
等一下 然后,验证该成员已在IAM下的GCP控制台中删除。
启用Cloud Functions API:
gcloud services enable cloudfunctions.googleapis.com --project la-cloud-functions
返回GCP控制台。您应该找到一个新的Google Cloud Functions Service代理成员。
注意:
您使用错误的命令添加cloudfunctions.serviceAgent
。这是正确的命令:
gcloud projects add-iam-policy-binding la-cloud-functions --member="serviceAccount:[email protected]" --role="roles/cloudfunctions.serviceAgent"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句