Link Search Menu Expand Document

SqlBak-CLI documentation

Source Section

The settings for SQL Server connection are specified in the source field of the backup job specification, or in the target field if type is specified as mssql.

{
	"source_type": "mssql",
	"data_source": <String>,
	"is_integrated_security": <true\false>,
	"user_name": <String>,
	"user_password": <String>,
	"trust_server_certificate": <true\false>
	"backup_folder": <String>,
	"backup_items": {
		"items": [ <string array> ],
		"item_types": [ <???> ]
	}
}

Mandatory fields

data_sources

SQL Server address. Note, in order to have access to the created SQL Server backups, the application must be installed on the same server where SQL Server is installed. Therefore, only the local instance name can be used in this field.

is_integrated_security

Specifies whether to use Windows Authentication to connect to SQL Server. Only for Windows.

user_name

The SQL Server login.

user_password

Login password. Use the encrypt command to keep the password encrypted.

trust_server_certificate

Whether to trust the server’s certificate.

ALLOWED VALUES:

true – no certificate verification will be performed during an SQL Server connection

false – during SQL Server connection, the server’s certificate will be verified

Fields that describe what should be backed up and how

backup_folder

The path to a directory to which a backup will be performed. A user on behalf of whom SQL Server runs (mssql user) must have write permissions to this directory.

backup_items

In this field, the databases that should be backed up should be specified.

This field can be filled in two ways:

  • Specify a list of databases separated by commas:
    ...
    "backup_items": {
        "items": [ Database1,Database2,Database3 ]
    }
    ...
  • Specify the all_mssql_custom parameter in item_types.In this case, all non-system databases will be backed up:
    ...
    "backup_items": {
        "item_types": [ all_mssql_custom ]
    }
    ...

Examples

Settings for a local SQL Server connection to backup two databases: DataOne and MediaOne:

...

"source": {
	"source_type": "mssql",
	"data_source": ".",
	"is_integrated_security": false,
	"trust_server_certificate" : true,
	"user_name": "sa",
	"user_password": "secret-password",
	"backup_items": {
		"items": ["DataOne", "MediaOne"]
	}
}

...