-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Disclosure
I faced this issue when I was setting up SSO with the assistance of Claude, and it identified this issue and helped me remedy. Thus I found it natural to use it in generating a clear description of the bug. I used claude to assist me in generating everything after this section.
Summary
When a user enters an SSO session name containing a space (e.g., "My Session") during aws configure sso, the CLI generates a ~/.aws/config file where the [sso-session] section header wraps the name in single quotes but profile entries reference it without quotes. The AWS CLI tolerates this mismatch, but the AWS SDK for JavaScript (used by tools like AWS CDK) does not, resulting in credential resolution failures.
Workaround
Use a session name without spaces (e.g., my-session).
Environment
> aws --version
aws-cli/2.15.46 Python/3.11.8 Darwin/24.3.0 exe/x86_64 prompt/offRegression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
One of the following:
- Reject spaces in session names during
aws configure ssowith a validation error, or - Generate consistent references so that the section header and profile values match regardless of how downstream tools parse the config file
Current Behavior
The CLI generates the following in ~/.aws/config:
[profile AdministratorAccess-123456789012]
sso_session = My Session
sso_account_id = 123456789012
sso_role_name = AdministratorAccess
region = us-east-1
[sso-session 'My Session']
sso_start_url = https://d-xxxxxxxxxx.awsapps.com/start/
sso_region = us-east-1
sso_registration_scopes = sso:account:accessNote the mismatch: the profile references sso_session = My Session (no quotes) while the section header is [sso-session 'My Session'] (with quotes).
aws sso login --profile AdministratorAccess-123456789012succeeds- AWS CDK
cdk bootstrap --profile AdministratorAccess-123456789012fails with:AuthenticationError: Need to perform AWS calls for account 123456789012, but no credentials have been configured
Reproduction Steps
- Run
aws configure sso - Enter a session name with a space, e.g.,
My Session - Complete the SSO configuration flow
- Run a CDK command with the AWS profile you just configured
Possible Solution
No response
Additional Information/Context
No response
CLI version used
aws-cli/2.15.46 Python/3.11.8 Darwin/24.3.0 exe/x86_64 prompt/off
Environment details (OS name and version, etc.)
MacOS 15.3.1