"uaac users --count" command doesn't return expected number of records
search cancel

"uaac users --count" command doesn't return expected number of records

book

Article ID: 298350

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

When attempting to retrieve UAA users with uaac CLI based on some filters, it always returns 500 records regardless of "--count" option specified on the command line even though there are more than 500 users existing in UAA. For example when there are 700 users with ldap origin in UAA, the following command will only return 500.
$ uaac users --count 1000 | grep 'origin: ldap\|username' | grep -v ldap | awk '{print $2}' | wc -l
500 
This is because uaac command will submit API call to UAA endpoint to retrieve required info, but there is a limitation for UAA to return a maximum of 500 entries one time at present. 

Environment

Product Version: 2.11

Resolution

The "--start" option can be utilized together with "--count" to retrieve records over 500. 
$ uaac users -h

  users [filter]                   List user accounts
                                   -a | --attributes <names>, output for each user
                                   --start <number>, start of output page
                                   --count <number>, max number per page
For the example given above, run following commands to retrieve all 700 UAA users.
$ uaac users --count 500 --start 1 -a username,origin | grep 'origin: ldap\|username' | grep -v ldap

$ uaac users --count 500 --start 501 -a username,origin | grep 'origin: ldap\|username' | grep -v ldap