I've a server, where I use the gcloud command for monitoring purposes. Previously I used the gcloud auth login for authentication, but now I'd like to use a more secure method with service accounts. I stopped my VM, create a service account with Owner roles, but when I use the gcloud project list, I only see the currenct project. But I have 3 other projects, how can I access every project with a service account?


To achieve that, you will have to activate the service account with [1]:

$ gcloud auth activate-service-account --key-file=[KEY:JSON]

and then initialize the gcloud command with [2]:

$ gcloud init

[1] https://cloud.google.com/sdk/gcloud/reference/auth/activate-service-account [2] https://cloud.google.com/sdk/gcloud/reference/init

  • Thanks, but I think you misunderstood me. I could set up the service account on the server, but it only see the project of the server. But I want to see every project in my cloud. – Roberto Apr 11 '18 at 13:19
  • Once you have created the service account you must add this service account to all the project that you what to have access to and add the IAM permissions for each project. – Pol Arroyo Apr 12 '18 at 8:41
  • How can I do this? As I see I can only add a new service account in the other projects. I don't see any option to add an existing service account. – Roberto Apr 12 '18 at 10:47
  • 1
    Once you have created the service account in one project you can add the created mail as a new IAM user and add the needed permissions on the other projects. – Pol Arroyo Apr 13 '18 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.