ctl: Bulk Import Commands
This article covers every "bulk import" command in ctl, the Xona command-line tool: adding many connections, users, groups, or relays at once instead of one at a time in the web UI.
Adding many connections, users, groups or relays at once with ctl, instead of one at a time in the web UI. To read or export objects instead, see ctl: Bulk List Commands.
Naming: this article uses the v5.5.4 product names - Gateway (formerly CSG) and Manager (formerly XCM). Appliances on older versions, and their documentation, use the old names for the same things.
ℹ First time using
ctl?This article assumes
ctlis installed, pointed at your appliance and logged in. If it is not, work through ctl: Getting Started first - there is no username-and-password login, so the first API key has to be created in the web UI beforectlcan log in at all.
⚠ There is no bulk permissions command
If what you need is “give this group access to 50 connections at once,”
ctlcannot do it today - talk to your Xona representative. This article only covers creating connections, users, groups and relays.
Before you run a real import
- ☐ Your input file is a CSV (or JSON for X-Connections). Excel, Google Sheets and Numbers can all export
.csv - ☐ Test on a 2-3 row file first. It takes seconds and confirms your column names and formatting before you commit to a large import
- ☐ You know whether you are on a Gateway or an Manager - on a Manager most commands need one extra argument, see below
- ☐ You have read How a bad row is handled - the behaviour differs by object type and it matters
ctl <command> --help shows a command's exact options at any time.
At a glance
| To bulk-add... | Command | Input | If one row is bad |
|---|---|---|---|
| Connections | ctl conn add-bulk-csv |
CSV | Nothing is created |
| Users | ctl users add-bulk-csv |
CSV | Rest still go through |
| Groups | ctl groups add-bulk-csv |
CSV | Rest still go through |
| Relays | ctl relay add-bulk-csv |
CSV | Rest still go through |
| X-Connections | ctl x-connect add-bulk |
JSON | Nothing is created |
How a bad row is handled - read this before a large import
This is the single most important thing to know before importing onto a live system, because the two behaviours demand opposite preparation.
NO - Connections & X-Connections: all or nothing
50 rows, 1 problem - a duplicate name, a name already in use, a disallowed setting - and none of the 50 are created. Fix the row and re-run the whole file.
So: check for duplicate or already-existing names before running. One collision anywhere stops everything.
OK - Users, groups & relays: row by row
50 rows, 1 problem - that one is skipped and the other 49 are created. The output names which rows succeeded and which were skipped, and why.
So: read the output afterwards. A command that finishes cleanly does not mean every row landed.
Adding connections
| On a Gateway - ctl |
|---|
ctl conn add-bulk-csv rdp my-connections.csv |
The word after add-bulk-csv is the connection type: rdp, ssh, telnet, vnc or web.
| On a Manager - the Gateway name goes first - ctl |
|---|
ctl conn add-bulk-csv |
These must match exactly: MyGatewayName
Column reference by connection type
Every type needs these three: name, showMonitorDialog (TRUE/FALSE), approvalLifetimeMin (minutes).
| Type | Extra columns needed |
|---|---|
rdp |
domain, hostname, manualLogin, password, port, username |
ssh |
hostname, manualLogin, password, port, username |
telnet |
hostname, manualLogin, password, port, username |
vnc |
hostname, manualLogin, password, port, username |
web |
appUrl only |
⚠
--helpis wrong for non-RDP typesThe built-in help text always prints the RDP column list, whichever type you are importing. Use the table above - it is accurate for every type.
You can leave username blank where a connection does not need one - an empty cell is fine, just do not remove the column. Any setting you omit a column for uses Xona's standard default (RDP connections, for example, default to clipboard access on), so you only need to specify what differs from the default.
Examples
| Three RDP servers - my-connections.csv |
|---|
name,showMonitorDialog,approvalLifetimeMin,domain,hostname,manualLogin,password,port,username |
These must match exactly: name,showMonitorDialog,approvalLifetimeMin,domain,hostname,manualLogin,password,port,username
| Two SSH servers - CSV |
|---|
name,showMonitorDialog,approvalLifetimeMin,hostname,manualLogin,password,port,username |
These must match exactly: name,showMonitorDialog,approvalLifetimeMin,hostname,manualLogin,password,port,username
| Two web connections - note how few columns are needed - CSV |
|---|
name,showMonitorDialog,approvalLifetimeMin,appUrl |
These must match exactly: name,showMonitorDialog,approvalLifetimeMin,appUrl
Adding users, and putting them straight into groups
| Import users - ctl |
|---|
ctl users add-bulk-csv my-users.csv |
| Three new employees, two of them into groups immediately - my-users.csv |
|---|
email,fullName,initialPassword,organization,username,groups |
These must match exactly: email,fullName,initialPassword,organization,username,groups and "Engineers,OnCall"
The groups column is optional per row - leave it blank, like Tom Clark, to create the user without any group. For more than one group, separate names with commas and quote the whole cell, like Bob Wong.
⚠ A group name that does not match is skipped silently - but the user is still created
The name must match an existing group exactly. A typo leaves you with a real user who is in none of the groups you intended, which is easy to miss. Verify your group names before a large import.
Adding groups
| Import groups - ctl |
|---|
ctl groups add-bulk-csv my-groups.csv |
| Two groups, one tied to AD and SSO names - my-groups.csv |
|---|
name,adName,ssoName |
These must match exactly: name,adName,ssoName
adName and ssoName are optional - leave them blank for a group not tied to AD or SSO, like Contractors. name is required on every row.
Adding relays
| Import relays - ctl |
|---|
ctl relay add-bulk-csv my-relays.csv |
| Two relays, the second with multiple allowed IPs - my-relays.csv |
|---|
name,host,srcPort,dstPort,maxDurationMinutes,protocol,allowListIPs |
These must match exactly: name,host,srcPort,dstPort,maxDurationMinutes,protocol,allowListIPs and "10.0.0.5,10.0.0.6"
Multiple allowed IPs go in the same allowListIPs cell, comma-separated, with quotes around the whole cell.
Adding X-Connections
| Import X-Connections - ctl |
|---|
ctl x-connect add-bulk my-xconnections.json |
This one takes JSON, not CSV, and there is no CSV option today. Ask your Xona representative for a template if you need one.
Formatting rules that apply to every command above
| Rule | Detail |
|---|---|
| Column order does not matter | As long as the header row has the right names, arrange them however you like |
| TRUE/FALSE columns are forgiving | TRUE, true, True, 1 for yes; FALSE, false, False, 0 for no |
| Save as real CSV | Choose “CSV” when exporting from Excel or Sheets - not “Excel Workbook” |
| Any cell containing a comma must be quoted | "10.0.0.5,10.0.0.6" |