Created
August 3, 2020 21:12
-
-
Save ashwinrs/54bc9a7df974670201d88a0ed5dfba08 to your computer and use it in GitHub Desktop.
How to run CLI command as a Google service account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download service account key (this will require ServiceAccount Key Admin role) | |
gcloud iam service-accounts keys create ./key.json --iam-account <service_account> | |
# Set following env var to point to the service account key file | |
export GOOGLE_APPLICATION_CREDENTIALS=./key.json | |
# Keep in mind that changing gcloud auth by the below command, will not work as only "gcloud" commands use it, | |
# gcloud auth activate-service-account <service_account> --key-file=./key.json | |
# gcloud auth list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment