How can I grant the account permission to list enabled APIs?

纵饮孤独 提交于 2021-02-06 15:49:35

问题


During a build on Cloud Build, I get the following warning:

Step #2: WARNING: Unable to verify that the Appengine Flexible API is enabled for project [xxxxx]. You may not have permission to list enabled services on this project. If it is not enabled, this may cause problems in running your deployment. Please ask the project owner to ensure that the Appengine Flexible API has been enabled and that this account has permission to list enabled APIs.

I'd like to get rid of this warning to get a clean build log.

Since the build succeeds, the problem must not be with Appengine Flexible API being disabled.

No; the problem must be that the account does not have permission to list enabled APIs. How can I fix that (either in the Console or at the command line)?


回答1:


To list the services available, you need the permission services.list. You can grant this permission via granting a role that includes said permission, like roles/serviceusage.serviceUsageViewer, or you can create your own personalised role with that permission only, if you wish to.

On how to enable the API: First check if said account has or hasn't said API enabled, which looks unlikely, with $ gcloud services list. By default, it shows all the enabled services for said account.

If you can't see 'appengineflex.googleapis.com' in said list, you can run $ gcloud services enable appengineflex.googleapis.com to do so.




回答2:


To verify your account and enable the API within the cloudbuild I had to add the account as role/App Engine Deployer and that worked on my case. Also on another project I've created new SA and that I've added Editor permissions and that worked too. It was for testing purposes but it worked.

The steps to verify that it's working too below :

  • gcloud config set account youraccountname

  • gcloud config set project yourprojectname

Then : - gcloud auth activate-service-account yourname@yourproject.iam.gserviceaccount.com --key-file=yourfilekey.json

Then to verify that it's working do : gcloud services list and you will see all the NAME and the TITLE of your services list.




回答3:


I ran into this issue today. I needed to makes sure that billing was enabled on the project and my profile. I would check the Billing section for those that also see this issue.



来源:https://stackoverflow.com/questions/51912812/how-can-i-grant-the-account-permission-to-list-enabled-apis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!