Reputation: 51
After logging in IBMCloud with account(say account-1) by using CLI, how to switch to another account(say account-2) without logging out?
commands:
ibmcloud login --sso
, then select account-1.
Does IBMCloud CLI have a command for account switching?
Upvotes: 5
Views: 3465
Reputation: 91
This is how we switch an account via CLI at IBM cloud
login to account
$ ibmcloud login -a cloud.ibm.com --sso
$ ibmcloud account list
$ ibmcloud target -c <<accpunt_id>>
example:
$ ibmcloud target -c 0XXXXXXXXXXXXXXXXXXXXXXXX
Targeted account IPOPS Test - PROD (0XXXXXXXXXXXXXXXXXXXXXXXX) <-> 20XXXX2
API endpoint: https://cloud.ibm.com
Region: us-south
User: g***[email protected]
Account: g account - (XXXXXXXXXXXXXXXXXXXXX) <-> 2041792
Resource group: No resource group targeted, use 'ibmcloud target -g RESOURCE_GROUP'
CF API endpoint:
Org:
Space:
Upvotes: 9
Reputation: 21
You can use the following command to switch accounts, assuming you know the Account ID/GUID of the account where you'd like to switch:
ibmcloud target -c ACCOUNT_ID
Upvotes: 2