Fix Invoke-AWSSSOLogin failure when default profile is configured for SSO login#419
Open
sankettangade wants to merge 1 commit into
Open
Fix Invoke-AWSSSOLogin failure when default profile is configured for SSO login#419sankettangade wants to merge 1 commit into
sankettangade wants to merge 1 commit into
Conversation
ashishdhingra
approved these changes
May 27, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix
Initialize-AWSSSOConfiguration -ProfileName defaultso it writes the profile under[default]section header in~/.aws/configinstead of the[profile default]. Every profile uses[profile <name>]except the default profile, which must be just[default].Both AWS CLI and the existing
AWSLoginProfileMethodsin this project (used byInvoke-AWSLogin) already handle this edge case correctly.Changes:
SSOProfileMethods.RegisterSsoProfileAndSessionnow writes[default]when the profile name isdefaultSSOCmdlets.cs:122that referenced{ProfileName}in a branch where it was always null.Motivation and Context
Testing
Tested locally on Windows and on a fresh EC2 Windows instance:
Initialize-AWSSSOConfiguration -ProfileName defaultfollowed byInvoke-AWSSSOLogin(no args). Verified the section is written as bare[default]and the no-args login succeeds.Get-S3Bucketworks against the SSO-configured default profile.[default]withregionand other keys; confirmed unrelated keys survive after running the init cmdlet (matchesaws configure ssobehavior).-ProfileName myprofilestill produces[profile myprofile]as before.Dry-run
b4119f1b-f35a-4ac5-86ee-417e7173ad38Breaking Changes Assessment
No Breaking Changes
Screenshots (if appropriate)
Types of changes
Checklist
We require a second engineer to validate the PR before merging
New/existing dependencies impact assessment, if applicable
License