Import Resources
Last modified on February 1, 2023
This document will explain how to import multiple resources into StrongDM using the sdm admin datasources
command. It will also explain how to update resources.
Getting the JSON Template
StrongDM supports many resource types, 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.
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
.