How to set service key file for a single invocation of “gcloud” utility?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to set service key file for a single invocation of “gcloud” utility?



Is there a way to set a custom service key file for a single invocation of "gcloud" tool without running gcloud auth activate-service-account ?


gcloud auth activate-service-account



Similar to the related "gsutil" tool where this can be easily done using -o option:
gsutil -o Credentials:gs_service_key_file=path/to/credentials_file.json arg1 arg2 ...


-o


gsutil -o Credentials:gs_service_key_file=path/to/credentials_file.json arg1 arg2 ...




1 Answer
1



I've not tried this but, it appears, yes:



https://cloud.google.com/sdk/gcloud/reference/

gcloud --account="..."



gcloud --account="..."



You can authenticate multiple service accounts using gcloud auth activate-service-account and you can enumerate the list with gcloud auth list. You would then switch commands between them using theaccount` flag.


gcloud auth activate-service-account


gcloud auth list. You would then switch commands between them using the



Until your question, I'd always done this rather tediously through reconfiguring gcloud config set account ..., so thanks for helping me learn something new!


gcloud config set account ...





Thanks. This solution is not exactly what I was looking for, because it needs pre-configured set of accounts, but it is better than nothing.
– mechatroner
Aug 14 at 16:08






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard