Importing Local Users from a CSV file

Christopher Dakin

This article will show you how to create new Local users from an externally created CSV delimited file, using a worked example.

We will first create a task to import a CSV file and then chain that to a create user task.

 

Gathering information for the user creation

First, we need to determine which user attributes are required or available, so that a CSV file can be prepared.

Go to Triggers & Automation->Automations. Click Create.

Start typing in Create Local User in the task, and select this when it appears.

Take a look through all of the tabs to see all available text fields that you could use in the CSV file.

For Create local user, the available fields that can be used are:

  • Principal Name (the username)
  • Default password (if you turn the Generate Password slider off)
  • Assign Groups (can have multiple entries)
  • Fullname
  • Email
  • Mobile
  • Other Email (can have multiple entries)
  • Other Mobile Phone (can have multiple entries)

 

From the above, decide which information to use and how to format your CSV file.

For the example here, we will use Principal Name, Fullname, Email and Mobile only.

 

Our example file with 5 users looks like this:

user1,User One,user1@logonbox.com,000000000

user2,User Two,user2@logonbox.com,111111111

user3,User Three,user3@logonbox.com,222222222

user4,User Four,user4@logonbox.com,333333333

user5,User Five,user5@logonbox.com,444444444

 

Creating the automation to import the file

Go to Triggers & Automation->Automations. Click Create.

Give the new Automation a name and start typing in Import CSV in the task, and select this when it appears.

Take note of the Quote and Delimiter characters and ensure these match with the format of the CSV file you will be creating. You may wish to change the Quote character if you have these characters in user surnames and you may wish to change the delimiter character for similar reasons (for example if you wanted to create AD users and need to define an OU you could either surround the OU field with the quote character, or choose to use a different delimiter).

For our example, we can choose the default characters.

 

Select the Source tab.

For the Source, you may choose Upload (and upload the CSV file), Path (to read the file from a path directly on the LogonBox server) or Text (where you can paste the CSV text directly into a text field).

For this example. We select Upload, then click on Choose File and select the file.

Next, define the number of columns in the file in the Columns field. Our example has 4.

Then set whether the file has headers our not. The example does not so this can be left off.

 

As this will be a one time import, you may skip the Schedule tab.

In the Transaction tab, you can opt to turn on Fire Events. This will cause Audit Log events to be recorded. For this example, we will turn on Fire Events.

Transaction Required can be useful when chaining events as in this article, to protect the database from any corruption in the case of any failures, so turn this on also.

 

On the Repeat tab, leave Repeat as Never and Every as 0, as we will be triggering this automation manually.

In the Notes tab, you can optionally enter some information as to what you have created this trigger for if you want.

Click Create to create the new Automation.

You will now see the newly created Automation. Click on the + symbol to its left to expand the Automation. Now click on the + icon in the Import module, this will chain a new task to this one.

 

Creating the Import User automation

For the chained automation, give it a name such as Create User.

The event will already be filled with Import CSV which is correct.

Set the Triggers On to Success (i.e we only want the system to create users if the CSV file imported okay).

For Triggers Task, start typing in Create Local User and select it from the list when it appears.

We have no specific conditions to meet so the Conditions tab can be left as default.

 

Select the Credentials tab. In Principal Name click on the ${} button to the right, then select the appropriate column from your CSV file. As this was the first column in our example, we select ${attr.column1}.

Set the Send Notification, Force Password Change (on first login) and Generate Password as per your preferences.

 

Select the Groups tab. If you want to add groups you have a choice. If you want all imported users to be in a particular group, you can start typing the group name and select it from a list. If you want to set the groups from the CSV file, you can click the ${} insert variable link and enter a column number. You can add multiple columns if you define multiple groups in the CSV.

Our example has no groups, so this will be left blank.

 

In the Details tab, do the same again for Fullname, Email, Mobile as required.

In our example, these are columns 2, 3 and 4 respectively.

 

Finally, in Additional Contacts you may add in Other Email and Other Mobile Phone. As per the Groups, multiple entries may be used. Our example does not define any of these.

 

Click Create to complete the automation.

The expanded Import automation now shows the chained triggers.

 

Running the Import

As we set this up with no Schedule or Repeat, this task is set to run only on demand.

When ready, click the green gears icon next to the automation and click Run Now.

 

The automation runs and your users are created.