Automated Import of Datasources

This document will explain how to import multiple datasources into strongDM using the sdm admin datasources command. It will also explain how to update datasources.

Getting the JSON Template

strongDM supports 25+ databases (and counting!), and each has its own import format. To see a list of datasource types supported by strongDM, use the sdm admin datasources add command. After finding the name of your datasource type, you can then use the sdm admin datasources add <type> --template > import.json command to get a JSON import template for the datasource type specified.

Example Import JSON

You can mix and match multiple database types when importing. For example, the following JSON adds both a PostgreSQL and a MySQL datasource.

You’ll notice how each datasource type has different fields.

Note: The name field must be unique for each datasource.

[
	{
		"type": "postgres",
		"name": "postgres datasource",
		"hostname": "",
		"port": "",
		"username": "",
		"password": "",
		"database": "",
		"schema": "",
		"overrideDatabase": "true",
		"portOverride": ""
	},
	{
		"type": "mysql",
		"name": "mysql datasource",
		"hostname": "",
		"port": "",
		"username": "",
		"password": "",
		"database": "",
		"portOverride": ""
	}
]

The portOverride field is only required if you are using the Port Override feature. You can also find out more information about each field by running the sdm admin datasources add <type> command.

Running the Import

Once you have created your JSON file, you can easily import it into strongDM.

sdm admin datasources add --file import.json

Updating Datasources

To get the current datasource state in JSON format, run sdm admin datasources list -j -e > export.json. Once you have the state, you can modify the JSON and update the datasources by running sdm admin datasources update --file export.json.