Skip to content

Instantly share code, notes, and snippets.

@gavinzhou
Created March 18, 2019 01:54
Show Gist options
  • Save gavinzhou/16f126436b2a7335fe9d50a86949ffdc to your computer and use it in GitHub Desktop.
Save gavinzhou/16f126436b2a7335fe9d50a86949ffdc to your computer and use it in GitHub Desktop.
How to use multiple service accounts with gcloud
$ gcloud config configurations create my-project1-config
$ gcloud config configurations activate my-project1-config
$ gcloud auth login # or activate-service-account
$ gcloud config set project project1 # and any other configuration you need to do
$ gcloud config configurations create my-project2-config
$ gcloud config configurations activate my-project2-config
$ gcloud auth login # or activate-service-account
$ gcloud config set project project2 # and any other configuration you need to do
$ CLOUDSDK_ACTIVE_CONFIG_NAME=my-project1-config gcloud ...
$ CLOUDSDK_ACTIVE_CONFIG_NAME=my-project2-config gcloud ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment