If you have two accounts below:
- Sample account 1
- config name: account1
- project ID: hoge-fuga-123
- account: sample@account1.sample
- Sample account 2
- config name: account2
- project ID: hoge-fuga-456
- account: sample@account2.sample
STEP 1. create configuration set for account1
% gcloud config configurations create account1
Created [account1].
Activated [account1].
% gcloud config set project hoge-fuga-123
Updated property [core/project].
% gcloud config set account sample@account1.sample
Updated property [core/account].
STEP 2. create configuration set for account2
% gcloud config configurations create account2
Created [account2].
Activated [account2].
% gcloud config set project hoge-fuga-456
Updated property [core/project].
% gcloud config set account sample@account2.sample
Updated property [core/account].
STEP 3. switch to account1 and check config
% gcloud config configurations activate account1
Activated [account1].
% gcloud config list
[core]
account = sample@account1.sample
disable_usage_reporting = False
project = hoge-fuga-123
Your active configuration is: [account1]
STEP 4. switch to account2 and check config
% gcloud config configurations activate account2
Activated [account2].
% gcloud config list
[core]
account = sample@account2.sample
disable_usage_reporting = False
project = hoge-fuga-456
Your active configuration is: [account2]
GCP original reference page: https://cloud.google.com/sdk/gcloud/reference/config/configurations/
Top comments (0)