Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Platform Service Account is Unable to Access Project

I encounter the following warning:

WARNING: You do not appear to have access to project [$PROJECT] or it does not exist.

after running the following commands locally:

  1. Activate and set a service account:

    gcloud auth activate-service-account \
    $SERVICE_ACCOUNT \
    --key-file=key.json
    
    #=>
    
    Activated service account credentials for: [$SERVICE_ACCOUNT]
    
  2. Select $PROJECT as the above service account:

    gcloud config set project $PROJECT
    
    #=>
    
    Updated property [core/project].
    WARNING: You do not appear to have access to project [$PROJECT] or it does not exist.
    

My own GCP account is associated with the following roles:

  • App Engine Admin
  • Cloud Build Editor
  • Cloud Scheduler Admin
  • Storage Object Creator
  • Storage Object Viewer

Why is this service account unable to set $PROJECT? Is there a role or permission I am missing?

like image 204
bryan Avatar asked Nov 06 '19 15:11

bryan


People also ask

Does not have permission to access projects instance Google Cloud?

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.


2 Answers

The solution to this issue might be to enable the Cloud Resource Manager API in your Google Cloud Console here by clicking enable.

like image 200
Buchanora Avatar answered Sep 22 '22 14:09

Buchanora


I believe this is an erroneous warning message. I see the same warning message on my service account despite the fact that the account has permissions on my GCP project and can successfully perform necessary actions.

You might be seeing this error due to an unrelated problem. In my case, I was trying to deploy to AppEngine from a continuous integration environment (Circle CI), but I hadn't enabled the App Engine Admin API. Once I enabled the API, I was able to deploy successfully.

like image 38
mtlynch Avatar answered Sep 22 '22 14:09

mtlynch