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?
Для этого необходимо активировать служебную учетную запись с помощью [1]:
$ gcloud auth activate-service-account --key-file=[KEY:JSON]
и инициализировать команду gcloud с помощью [2]:
$ gcloud init
[1] https://cloud. google.com/sdk/gcloud/reference/auth/activate-service-account [2] https://cloud.google.com/sdk/gcloud/reference/init