← Getting Started | Authentication(中文) | Configuration →
Volcengine CLI supports config profiles, the environment-based default credential chain, SSO, and Console Login. Authentication configuration is stored in ~/.volcengine/config.json.
When a service command creates an SDK client, credentials and runtime settings are resolved in this order:
---profile: applies only to the current invocation and must reference an existing profile.- The
currentprofile in the config file. - The profile named by
VOLCENGINE_PROFILEorVOLCSTACK_PROFILE. - The SDK default credential chain: environment variables, OIDC, CLI config provider, ECS instance role, and other SDK providers.
Region priority:
---regionregionin the profileVOLCENGINE_REGION
Endpoint priority:
---endpointendpointin the profileVOLCENGINE_ENDPOINT
When endpoint-resolver or VOLCENGINE_ENDPOINT_RESOLVER is standard, the SDK standard endpoint resolver is used and explicit endpoint is ignored. Setting endpoint to auto-addressing also enables the standard endpoint resolver.
| Mode | Purpose | Required fields |
|---|---|---|
ak |
Static AK/SK credentials, the default mode | access-key, secret-key |
sso |
Single sign-on | configured with ve configure sso |
console-login |
Console OAuth login with temporary STS credentials | written by ve login |
ramrolearn |
AssumeRole via STS with AK/SK | access-key, secret-key, role-name, account-id |
oidc |
Exchange an OIDC token for temporary credentials | oidc-token-file, role-trn |
ecsrole |
ECS instance role through IMDS | role-name |
ve configure set validates required fields for the selected mode. When updating an existing profile, omitted fields keep their previous values. Creating or updating a profile makes it the current profile. ve configure sso is the exception: it writes an SSO profile but does not switch the current profile.
ve configure set --profile prod --mode ak --region cn-beijing --access-key AK --secret-key SK--mode ak can be omitted:
ve configure set --profile prod --region cn-beijing --access-key AK --secret-key SKTemporary credentials can include a session token:
ve configure set --profile sts-dev --region cn-beijing \
--access-key AK --secret-key SK --session-token SESSION_TOKENve configure set --profile ram-dev --mode ramrolearn --region cn-beijing \
--access-key AK --secret-key SK \
--role-name YourRoleName --account-id 2100000000ve configure set --profile ci-oidc --mode oidc --region cn-beijing \
--oidc-token-file /var/run/secrets/oidc-token \
--role-trn trn:iam::2100000000:role/CIRoleve configure set --profile ecs-role --mode ecsrole --region cn-beijing \
--role-name YourEcsRoleNameprofile: Profile name. Required when creating or updating a profile.
mode: Credential mode. One of ak, sso, console-login, ramrolearn, oidc, ecsrole. New profiles default to ak when omitted.
access-key: Access Key.
secret-key: Secret Key.
session-token: Temporary credential session token.
region: API region. Optional during configure set, but required by API calls through profile, ---region, or VOLCENGINE_REGION.
endpoint: Custom endpoint. Ignored when endpoint-resolver is standard.
endpoint-resolver: Set to standard to use the standard endpoint resolver.
http-proxy: HTTP proxy used by the SDK when SSL is disabled.
https-proxy: HTTPS proxy used by the SDK.
disable-ssl: Whether to disable SSL. Written only when explicitly provided.
use-dual-stack: Whether to enable dual-stack endpoints. Written only when explicitly provided.
role-name: Required for ramrolearn and ecsrole.
account-id: Required for ramrolearn.
oidc-token-file: Required for oidc.
role-trn: Required for oidc.
login-session: console-login field written by ve login. Do not configure it manually.
sso-session: sso field written by ve configure sso.If no usable profile is active, the CLI uses the SDK default credential chain. The most common setup is AK/SK environment variables:
export VOLCENGINE_ACCESS_KEY=AK
export VOLCENGINE_SECRET_KEY=SK
export VOLCENGINE_REGION=cn-beijing
# Optional: temporary credentials
export VOLCENGINE_SESSION_TOKEN=SESSION_TOKEN
# Optional: endpoint settings
export VOLCENGINE_ENDPOINT=open.volcengineapi.com
export VOLCENGINE_ENDPOINT_RESOLVER=standard
# Optional: network settings
export VOLCENGINE_DISABLE_SSL=false
export VOLCENGINE_USE_DUALSTACK=falseOIDC environment variables:
export VOLCENGINE_OIDC_TOKEN_FILE=/path/to/oidc/token
export VOLCENGINE_OIDC_ROLE_TRN=trn:iam::2100000000:role/YourRoleName
export VOLCENGINE_REGION=cn-beijingTo ensure only explicit profiles are used, disable the default credential chain:
export VOLCENGINE_DISABLE_DEFAULT_CREDENTIALS=trueWhen this is set and no active profile exists, the CLI returns an error instead of trying environment variables or IMDS.
SSO uses two layers:
sso-session: enterprise SSO entry point with Start URL, Region, and Scopes.- SSO profile: an account and role binding with
mode=sso,sso-session-name,account-id,role-name,region, and related fields.
# 1. Create an SSO session. registration-scopes can be omitted
ve configure sso-session --name my-sso \
--start-url https://{custom}.volccloudidentity.com/userportal \
--region cn-beijing
# 2. Create an SSO profile, authorize with device code, and select account and role
ve configure sso --profile my-dev --sso-session my-sso
# 3. Switch the current default profile
ve configure profile --profile my-dev
# 4. Call APIs with that profile
ve sts GetCallerIdentityve configure sso does not switch the current profile. If you skip step 3, service commands keep using the previous current profile.
| Command | When to use it | What it does | Switches current |
|---|---|---|---|
ve configure sso-session |
Usually once per SSO entry point | Stores Start URL, Region, and Scopes; reusable by multiple SSO profiles | No |
ve configure sso |
Once per account + role combination | Links an SSO session, performs first authorization, selects account and role, writes an SSO profile | No |
ve configure profile --profile NAME |
When service commands should use a profile by default | Switches current profile | Yes |
ve sso login |
When prompted to log in again, or to refresh SSO login state explicitly | Runs device authorization again and caches access token | No |
ve sso logout |
To log out one or all SSO sessions | Revokes cached tokens, removes token cache, clears STS temporary credentials | No |
ve configure sso-session --name my-sso \
--start-url https://{custom}.volccloudidentity.com/userportal \
--region cn-beijing \
--registration-scopes cloudidentity:account:access,offline_accessParameters:
name: SSO session name. Omit it to enter interactive selection/creation mode.
start-url: SSO Start URL, usually your sign-in URL with the /userportal suffix.
region: SSO region. Defaults to cn-beijing.
registration-scopes: Comma-separated scope list. Defaults to cloudidentity:account:access,offline_access.Scopes can only be cloudidentity:account:access and offline_access. The CLI trims, deduplicates, and validates them. When editing an existing session, Start URL, Region, and Scopes are prefilled; press Enter to keep the current value.
ve configure sso --profile my-dev --sso-session my-ssoFor servers without a GUI:
ve configure sso --profile my-dev --sso-session my-sso --no-browserIf --profile is empty, the interactive flow lets you press Enter and defaults to {sso-role-name}-{sso-account-id}. If the named --sso-session does not exist, the command guides you through creating it.
When the current profile is an SSO profile, service commands automatically check and refresh STS temporary credentials:
- Reuse
session-tokenwhen it has not expired. - If STS credentials are missing or expired, use cached SSO access token plus
account-id/role-nameto request new STS credentials and write them back to the profile. - If the SSO access token is expired or close to expiry, only a silent refresh with refresh token is attempted. Service commands do not automatically open a browser.
- If cache is missing, refresh token is missing, client registration expired, or refresh fails, the command asks you to run
ve sso login.
ve sso login --profile my-dev
ve sso login --sso-session my-sso
ve sso loginve sso login explicitly logs in again. Each run performs device authorization and does not silently exchange an existing refresh token for access token.
Options:
--profile: SSO profile to use. It must exist, be mode sso, and have sso-session configured.
--sso-session: SSO session to use. It must exist and be valid.
--no-browser: Disable automatically opening the browser.If neither --profile nor --sso-session is provided: no session returns an error; one session is used directly; multiple sessions open a searchable selection list.
ve sso logout --sso-session my-sso
ve sso logoutWithout a session name: no session returns an error; one session is logged out directly; multiple sessions open a selection list that also includes “All SSO sessions”.
Logout does:
- Revoke cached refresh token for the SSO session.
- Delete the token cache for the SSO session.
- Clear
access-key,secret-key,session-token, andsts-expirationfrom linked SSO profiles.
Logout does not delete SSO profiles, delete sso-session configuration, or clear account-id / role-name.
Console Login uses Volcengine Console OAuth 2.0 + PKCE and caches temporary STS credentials locally.
# Log in with the default profile. If region is omitted, the CLI prompts for it
ve login
# Specify profile and region
ve login -p dev -r cn-beijing
# Use cross-device login for headless servers or containers
ve login -p dev -r cn-beijing --remoteOptions:
--profile, -p: Profile name. Defaults to default.
--region, -r: Region. When omitted, the CLI prompts and uses cn-beijing if you press Enter.
--remote: Cross-device login. Open the printed URL in a browser and paste the authorization code back into the terminal.
--endpoint-url: Sign-in service endpoint. Defaults to https://signin.volcengine.com and normally does not need changes.After login, the profile is written as console-login mode with a login-session. Logging into a non-default profile does not switch active profile automatically:
ve configure profile --profile devEnd-to-end flow:
ve login --profile dev --region cn-beijing
ve configure profile --profile dev
ve sts GetCallerIdentity
ve logout --profile dev# Log out default profile
ve logout
# Log out a specific profile
ve logout -p dev
# Log out all console-login profiles in the current config
ve logout --allve logout only clears local login state: it removes cached credentials and clears login-session from the profile. It does not delete the profile or send a server-side logout request.
Notes:
- Without
--profile, onlydefaultis handled. The command does not automatically use current. - Only
console-loginprofiles are affected. AK and SSO profiles are not affected. --allignores--profileand clears allconsole-loginprofiles.
Service commands still use the old account after ve configure sso. What should I do?
Run ve configure profile --profile NAME to switch current. configure sso writes a profile but does not switch current.
When do I need ve sso login?
The first ve configure sso already authorizes. Daily service commands reuse or silently refresh credentials. Run ve sso login only when prompted or when you want to explicitly refresh SSO login state.
How do I log in on a machine without a graphical browser?
Use --no-browser for SSO and --remote for Console Login.
What should I enter for Scopes?
Usually nothing. The default is cloudidentity:account:access,offline_access.
← Getting Started | Authentication(中文) | Configuration →