How to export current usernames for an Okta app? Skip to main content
https://support.okta.com/help/answers?id=906f0000000dfdbia4&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Richard GrahamRichard Graham 

How to export current usernames for an Okta app?

James FloresJames Flores (Okta, Inc.)
Hi Richard, 

You can do this via the Okta API. I just took a look at Postman and in the Apps collection you can run this call  {{url}}/api/v1/apps/{{appId}}/users and it will return a list of users per a given app.

For more information on the Okta API please visit, http://developer.okta.com/docs/api/getting_started/api_test_client
Richard GrahamRichard Graham
I could also do this with Powershell if I could figure out the AppId for my application. Where can I find the AppID?
Gabriel SrokaGabriel Sroka (Okta, Inc.)
Hi Richard

The AppId can be found using the API or by clicking the App in Okta Admin and looking at the URL, eg:
https://YOUROKTAORG.oktapreview.com/admin/app/salesforce/instance/0oa6k5e19jwu8aEAS0h7
the "0oa6k5e19jwu8aEAS0h7" part is the AppId

Gabriel Sroka
Richard GrahamRichard Graham
Thank you. I used your OktaApi module in the PowerShell Gallery, but I cannot get more than 50 entries from the Get-OktaAppUser command: e.g., get-OktaAppUser –appid 0oa1a44x18tLiG9IK0h8 |format-list > cs26.txt Is there any way around this limitation with PowerShell? Regards, Richard Graham
Gabriel SrokaGabriel Sroka (Okta, Inc.)
Hi Richard
The Get-OktaAppUsers function has a -limit argument, so, to get 100 appusers, try this:
Get-OktaAppUsers -appid 0oa1a44x18tLiG9IK0h8 -limit 100
 
If you have a much larger number, you should use the pagination feature. There's some sample code here:
https://github.com/gabrielsroka/OktaAPI.psm1/blob/master/CallOktaAPI.ps1
See the Get-PagedUsers function, or here's some sample code:
 
function Get-PagedAppUsers {
    $totalAppUsers = 0
    $params = @{appid = "0oa1a44x18tLiG9IK0h8"; limit = 20}
    do {
        $page = Get-OktaAppUsers @params
        $appusers = $page.objects
        foreach ($appuser in $appusers) {
            Write-Host $appuser.credentials.userName
            $totalAppUsers++
        }
        $params = @{url = $page.nextUrl}
    } while ($page.nextUrl)
    "$totalAppUsers app users found."
}
 
Thanks.
 
Gabriel Sroka