Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do not have permission to access app while deploying google service account

After creating google service account with permission as shown below - deployment fails with message . I am failing to understand where this is going wrong.

====

$ gcloud iam service-accounts get-iam-policy [email protected]
bindings:
- members:
  - serviceAccount:[email protected]
  role: roles/owner
etag: Bxxxxxxxxg=

====

$ gcloud auth activate-service-account --key-file ../a.json 
Activated service account credentials for: [[email protected]]

$ gcloud app deploy
ERROR: (gcloud.app.deploy) You do not have permission to access app [appid].
like image 234
npr Avatar asked Sep 20 '16 12:09

npr


People also ask

Why do I not have permission to access an app instance?

Cloud Build does not have permission to access my App Engine instance. To fix this, go into Settings under Cloud Build and enable access to App Engine, and any other cloud service you use in conjunction with Cloud Build. Then wait a moment for the settings to take effect and rerun the build.

Does not have permission to access apps instance or it may not exist ): The caller does not have permission?

The caller does not have permission to access project This error occurs if the account that you used to deploy your app does not have permission to deploy apps for the current project. To resolve this issue, grant the App Engine Deployer ( roles/appengine. deployer ) role to the account.

How do you check what permissions a service account has?

To see if a service account has access to a resource, call the getIamPolicy method on the target resource. For example, to view grants for a project, call the projects. getIamPolicy method." But to get organization level permissions, the service account do not have permission to do the API call.


4 Answers

For those who are trying to deploy using a service account and the gcloud commands, you will need to set all of the following roles:

  • App Engine Deployer (deploy new code)
  • Storage Object Viewer (list images)
  • Storage Object Creator (upload the image)
  • Cloud Build Editor (create build)
  • App Engine Service Admin (promoting the new version)

From the access control docs:

The App Engine Deployer role alone grants adequate permission to deploy using the Admin API. To use other App Engine tooling, like gcloud commands, you must also have the Storage Admin role and Cloud Build Editor role.

like image 192
m.spyratos Avatar answered Oct 19 '22 20:10

m.spyratos


Have got it working now.

$ gcloud app deploy --log-http --verbosity=debug

The reason why it was failing, seemed to be related to enabling the App Engine API (link was shown in command output). Enable the api - then try deploying again (this time without --log-http as this is resulting in a gcloud crash).

You can enable the "Google App Engine Admin API" through the Google Cloud Platform API console page. https://console.cloud.google.com/apis/api/appengine.googleapis.com/

like image 42
npr Avatar answered Oct 19 '22 19:10

npr


Run the following command to check weather the project is associated with the correct account.

gcloud config list

If it is not associated with the account then use

gcloud auth login

to configure it with correct project account.

like image 10
Bhavesh Avatar answered Oct 19 '22 21:10

Bhavesh


If you are trying to deploy a node app this may still be insufficient. My API was enabled and I followed everything on GCP's instructions, however I still got the You do not have permission to access app error. Finally fixed it by adding two more roles to the service account:

  • Project > Browser
  • Cloud Build > Cloud Build Service Account
like image 1
carnun Avatar answered Oct 19 '22 20:10

carnun