Skip to content

Initialize-AWSSSOConfiguration can fail if user has access to more than 20 accounts #401

@mcook71099

Description

@mcook71099

Describe the bug

The ListAccounts API is paginated and the SSOUtils.GetAccountIdsAsync method does not interate through the entire list

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I expected to be able to pass in a valid AWS Account number that shows in the AWS Identity Center

Current Behavior

I have over access to 800 accounts using my SSO credential. Currently, I get a false invalid account number returned from the cmdlet

Reproduction Steps

  • prereq : MUST have a very large number of accounts
    Initialize-AWSSSOConfiguration -ProfileName -AccountId -Region us-east-1 -RoleName

Possible Solution

Amazon.PowerShell.Common.Internal.SSOUtils.GetAccountIdsAsync(string accessToken, string ssoRegion, CancellationToken cancellationToken = default) need to include a loop to iterate through all accounts returned by the ListAccounts API when the NextToken returned is not null

Additional Information/Context

No response

AWS Tools for PowerShell version used

AWS.Tools.Common 5.0.32

PowerShell version used

Name Value


PSVersion 5.1.26100.6899
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.6899
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Operating System and version

Windows 11

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions