How to to get all UserNames from aws quicksight list-users cli

aws quicksight list-users --aws-account-id “xxxxxxxxxxxx” --namespace “default” --query UserList[*].[UserName]
with this one above only I’m getting the first 100 UserNames

aws quicksight list-users --aws-account-id “xxxxxxxxxxxx” --namespace “default”
Running this without the --query, I’m getting all the data but just again for the first 100 users since the max allowed to recive is 100 and I’m also I’m getting this below what I guess is the next-token value
100/rO0ABXQBiENBSXXXXXXXXXXXB4cAAAAABwcHA= d1d56a78-dc90-4ca5-a585-5631f31815a0 200

I have tried to use /rO0ABXQBiENBSXXXXXXXXXXXB4cAAAAABwcHA= as --next-token
or all together /rO0ABXQBiENBSXXXXXXXXXXXB4cAAAAABwcHA= d1dxxxxx-dc90-4ca5-a585-1111f31815a0
or just the last part only d1dxxxxx-dc90-4ca5-a585-1111f31815a0

aws quicksight list-users --aws-account-id “xxxxxxxxxxxx” --next-token “xxxxxx” --max-results “10” --namespace “default”

But I’m getting this error message
An error occurred (InvalidParameterValueException) when calling the ListUsers operation: AWS account id: xxxxxxxxxxxx, Namespace: default

Hi @igiraldo - The max-results value should be an integer. Can you please try the below link
aws quicksight list-users --aws-account-id XXXXXX --max-results 10 --namespace “default”

Hope this will help you.
Regards - Sanjeeb

Hi @Sanjeeb2022 Thank you for replying!
I tried as below
aws quicksight list-users --aws-account-id “XXXXXX” --next-token “rO0ABXxxxxBwcHA=” --max-results 100 --namespace “default”
Still getting this
aws :
At line:1 char:1

  • aws quicksight list-users --aws-account-id “xxxx” --next-toke …
  •   + CategoryInfo          : NotSpecified: (:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError

An error occurred (InvalidParameterValueException) when calling the ListUsers operation: AWS account id: xxxx, Namespace: default

Hi @igiraldo - Can you please remove " " in the --aws-account-id as well.

Regards - Sanjeeb

No luck :pensive: Same error message

Thank you - Ilies

Hi @igiraldo - Can you try the below command. I tested in myside and it is working… First test with max-result 10 and then increase to 125

aws quicksight list-users --aws-account-id <<give your account id>> --max-results 10 --namespace "default"

If possible, also submit a ticket to AWS customer support team ( link to raise a ticket - Creating support cases and case management - AWS Support) so that they can verify the details by see your screen. If you do not have access, request your aws admin team to help you on that.

Regards - Sanjeeb

Hi @Sanjeeb2022,

That works for me for the first 100 Users but I need all users. Let’s say about 325 users and the
–max-results limit is 100. I need to get the remaining 225 users. That’s because I’m trying to use the --next-token. Using the --next token works for you. If so, what value are you passing.

Hu @igiraldo - The below commands are working for me. Since I have very less users, first i set max result 2 and get the next token and use it in my second query. Can you copy this command to a notepad and do the necessary change and test it. If it is still not working, please raise a ticket to AWS customer support ( Link to raise a ticket is Creating support cases and case management - AWS Support) , they can help you as well.

aws quicksight list-users --aws-account-id XXXXX --max-results 2 --namespace "default"

aws quicksight list-users --aws-account-id XXXX  --next-token "2/rO0ABXBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAnBwcA==" --max-results 2 --namespace "default"

Regards - Sanjeeb

Hi @Sanjeeb2022 - Thank you so much for all your help o this. I identified the issue. When the token is to long it came in break lines. I had to remove the spaces and it worked.
I appreciated all your help! Have a great weekend!

1 Like

Wow @igiraldo . Thanks for confirming the issue is resolved. Can you mark this as solution so that it can help other community members.

Have a great weekend.

Regards - Sanjeeb