This script / directory structure allows for seeding in registered server lists into SSMS.
- Add one or more server definition json files in the server_lists directory (see below)
- Add a credentials.json file in the same directory as the import script
- Execute import_servers.ps1
Server definitions can be in one or multiple files and specify the following fields:
- server: the network name of the sql server
- db: the name of the database
- credential_name: the name of a credential supplied in the credentials.json file
- user: the username for this connection if credential_name is not supplied
- pass: the password for this connection if credential_name is not supplied
An example server definition file might look like the following:
[
{
"server": "SQL_SERVER_NAME",
"db": "DATABASE",
"credential_name":"my_credential",
"user":"my_sql_auth_username",
"pass":"my_sql_auth_password",
"registration_name":"DATABASE",
"path":"server_folder_path"
}
]
Specifying named credentials in the credentials.json file allows allows for configuring reusable credentials and for storing credentials in an external/local file that isn't tied to a given repository.
Credential definitions must be saved in a credentials.json file found at the same path as the import_servers.ps1 file. Credential definitions have the following format:
- name: the identifier used by a server registration to reference the credential
- user: the username for connections using this credential
- pass: the password for connections using this credential
An example credential.json file might look like the following:
[
{
"name": "my_credential",
"user": "my_username",
"pass": "my_password"
}
]