Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report

Qlik Cloud: export list of tenant users to file

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniele_Purrone
Support
Support

Qlik Cloud: export list of tenant users to file

Last Update:

Mar 11, 2024 3:51:03 AM

Updated By:

Daniele_Purrone

Created date:

Apr 5, 2023 4:04:01 AM

It is possible to export the list of tenatnt users to a .json file using the "user ls" command from the Qlik Command Line Interface (qlik-cli).

 

Environment

 

Resolution

 

The scripts provided in this article are provided as they are and they are for guidance only.   

 

As a tenant admin, download and configure the Qlik-cli 

 

  1. run

    qlik user ls --limit 1000 > tenantusers.json​


    (please note: the qlik-cli is able to paginate over the limit of 100 users that concerns the API it uses. So, setting a higher limit will produce the full list of users). 

    in a command prompt or UNIX shell. The resulting tenantusers.json file will be saved in the current path for the prompt/shell  and will be in this format, with the roles defined on top and the user details under them.

    [
      {
        "assignedGroups": [],
        "assignedRoles": [
          {
            "id": "608050f7634644db3678b1a2",
            "level": "user",
            "name": "Developer",
            "type": "default"
          },
          {
            "id": "608050f7634644db3678b17f",
            "level": "admin",
            "name": "TenantAdmin",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af862",
            "level": "user",
            "name": "SharedSpaceCreator",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af866",
            "level": "user",
            "name": "ManagedSpaceCreator",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af86b",
            "level": "user",
            "name": "DataSpaceCreator",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af85d",
            "level": "admin",
            "name": "AnalyticsAdmin",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af85f",
            "level": "admin",
            "name": "DataAdmin",
            "type": "default"
          },
          {
            "id": "63580b8d5cf9728f19217be0",
            "level": "user",
            "name": "PrivateAnalyticsContentCreator",
            "type": "default"
          },
          {
            "id": "6356f0425cf9728f1962b942",
            "level": "user",
            "name": "DataServicesContributor",
            "type": "default"
          }
        ],
        "created": "2020-05-18T09:38:29.214Z",
        "createdAt": "2020-05-18T09:38:29.214Z",
        "email": "martina.testoni@dkdaklaldkdaklladaaddddl.com",
        "id": "USERID1",
        "lastUpdated": "2023-04-04T07:32:00.756Z",
        "lastUpdatedAt": "2023-04-04T07:32:00.756Z",
        "name": "Martina Testoni",
        "picture": "https://s.gravatar.com/avatar/gravatarimage=pg\u0026d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fdp.png",
        "preferredLocale": "",
        "preferredZoneinfo": "Europe/Copenhagen",
        "roles": [
          "Developer",
          "TenantAdmin",
          "SharedSpaceCreator",
          "ManagedSpaceCreator",
          "DataSpaceCreator",
          "AnalyticsAdmin",
          "DataAdmin",
          "PrivateAnalyticsContentCreator",
          "DataServicesContributor"
        ],
        "status": "active",
        "subject": "auth0|SUBJECTID2",
        "tenantId": "TENANTID"
      },
      {
        "assignedGroups": [],
        "assignedRoles": [
          {
            "id": "608050f7634644db3678b17f",
            "level": "admin",
            "name": "TenantAdmin",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af86b",
            "level": "user",
            "name": "DataSpaceCreator",
            "type": "default"
          },
          {
            "id": "608050f7634644db3678b1a2",
            "level": "user",
            "name": "Developer",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af866",
            "level": "user",
            "name": "ManagedSpaceCreator",
            "type": "default"
          },
          {
            "id": "63580b8d5cf9728f19217be0",
            "level": "user",
            "name": "PrivateAnalyticsContentCreator",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af862",
            "level": "user",
            "name": "SharedSpaceCreator",
            "type": "default"
          },
          {
            "id": "6356f0425cf9728f1962b95c",
            "level": "user",
            "name": "Steward",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af85d",
            "level": "admin",
            "name": "AnalyticsAdmin",
            "type": "default"
          },
          {
            "id": "62bb165356d1879582c1b468",
            "level": "admin",
            "name": "AuditAdmin",
            "type": "default"
          },
          {
            "id": "605a1c2151382ffc836af85f",
            "level": "admin",
            "name": "DataAdmin",
            "type": "default"
          }
        ],
        "created": "2023-03-31T08:44:37.332Z",
        "createdAt": "2023-03-31T08:44:37.332Z",
        "email": "Gentile.Faccenda@dkdaklaldkdaklladaaddddl.com",
        "id": "USERID2",
        "lastUpdated": "2023-04-03T11:24:35.037Z",
        "lastUpdatedAt": "2023-04-03T11:24:35.037Z",
        "name": "Gentile Faccenda",
        "picture": "https://s.gravatar.com/avatar/randomurl=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fdp.png",
        "roles": [
          "TenantAdmin",
          "DataSpaceCreator",
          "Developer",
          "ManagedSpaceCreator",
          "PrivateAnalyticsContentCreator",
          "SharedSpaceCreator",
          "Steward",
          "AnalyticsAdmin",
          "AuditAdmin",
          "DataAdmin"
        ],
        "status": "active",
        "subject": "auth0|IDPSUBJECT2",
        "tenantId": "TENANTID"
      }
    ]
    

     

  2. Use any tool you like (online or not) to convert the json to csv, xlsx or other format. 

    In a PowerShell you can generate the users natively in csv format by using:

    qlik user ls --limit 1000 | ConvertFrom-Json | ConvertTo-Csv > tenantusers.csv​

 

Related Content

 

 

Comments
William_Wistam
Contributor III
Contributor III

@Daniele_Purrone wondering if there is a typo here, an extra "s" in user?

"qlik user ls > tenantusers.json"

instead of

"qlik users ls > tenantusers.json"

Note: "qlik users ls" doesn't work for me, "qlik user ls" does.

Thank you!

Daniele_Purrone
Support
Support

Hi @William_Wistam ,
definitely a typo! Thanks for spotting it, I have fixed it!

sanrout
Contributor III
Contributor III

@Daniele_Purrone  - I am able to export users but only few (count : 25) however we have more than 5000 users.

Daniele_Purrone
Support
Support

Hi @sanrout ,

yes, that's the standard limit.
You can increase that by adding a "--limit 100" and get 100 users instead.

Unfortunately, it's not possible to go over 100 in one batch, because that's a limitation of the API calls.
So, a solution is to build  some script that uses the "--filter" option and then build different filters to capture the whole list of users, according to the syntax specified at https://datatracker.ietf.org/doc/rfc7644 

Daniele_Purrone
Support
Support

Hi @sanrout , I have updated the articles with some scripts to go around the limitation. Can you please check? Thanks!

sanrout
Contributor III
Contributor III

Hi @Daniele_Purrone , it is working ! thank you.

Daniele_Purrone
Support
Support

Thanks for the feedback @sanrout ! Can I ask you if you used the powershell one or the bash one?

sanrout
Contributor III
Contributor III

@Daniele_Purrone  - It is the powershell script, JSON file size is ~5 GB !!

sanrout
Contributor III
Contributor III

@Daniele_Purrone  - can we get the tenantusers.json output in CSV format using CLI ? Currently we convert the data into csv using online tools after exporting the data into json format. 

Daniele_Purrone
Support
Support

Hi @sanrout , not with the qlik-cli, but you can use the native powershell commands.
If you have already created the tenantusers.json file, you can run:

Get-Content ./tenantusers.json |ConvertFrom-Json | ConvertTo-Csv > tenantusers.json

 

If you want to do everything in just one command you can run 

qlik user ls --limit 100  |ConvertFrom-Json | ConvertTo-Csv > tenantusers.csv

 

Contributors
Version history
Last update:
‎2024-03-11 03:51 AM
Updated by: