Created
August 10, 2023 06:02
-
-
Save geminixiang/8e5385ece266d1c628a80334f37ab24c to your computer and use it in GitHub Desktop.
gcloud switch to another service account
This file contains hidden or 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
SERVICE_ACCOUNT_NAME="" | |
PROJECT_ID="" | |
gcloud config configurations create $CONFIG_NAME | |
gcloud config set account $SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com | |
# you need to go https://console.cloud.google.com/iam-admin/serviceaccounts, and generate a new key | |
gcloud auth activate-service-account $SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com --key-file=key.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment