# SQL Server Guide

It only takes a few minutes to get started with Satori. What you need is:

- Access to the [**Satori Management Console**](https://app.satoricyber.com/).
- The hostname of your SQL Server data store, for example: `abc123.database.windows.net`

## Adding a SQL Server Data Store to Satori

Perform the following steps to add an SQL Server data store to your Satori account:

1. Login to the [**Satori Management Console**](https://app.satoricyber.com/).
2. In the **Data Stores view**, click the plus button to **add a new data store**.
3. Select the **SQL Server** option.
4. Enter an **informative name** for the data store, for example: _Sales Data Warehouse_.
5. Enter the **Hostname** of your **SQL database**, for example: `abc123.database.windows.net`.
6. Choose a **Data Access Controller** to use for this data store by selecting the **Cloud provider** and **Region**.
7. Click the **Add New Data Store** button.
8. You will be redirected to the **Data Stores list view**.

## Enabling Satori Authentication

To enable your data consumers to use temp credentials and personal access tokens you must activate these features for each of your data stores.

1. Go to the **Data Stores** view and select the **SQL Server** data store.
2. Click the **Authentication Settings** tab.
3. Go to the **Temporary Credentials** section and turn on the **Enable Satori Credentials** Toggle switch.
4. Enter the **username and password** used to connect to the data store. Satori stores credentials in an encrypted form.
5. To enable **Personal Access Tokens** for the data store turn on the **Enable personal access tokens for this data store** toggle switch.
6. Click **SAVE**.

## Connect to SQL Server Database via Satori

To connect to an SQL Server database using Satori use the Satori hostname that was generated by the management console which can be found under Satori Hostname in the data store settings view, for example: `abc123.us-east-1.a.s0.satoricyber.net`.

### Connecting with the JDBC driver

To connect with the JDBC driver, override or add the **host** parameter in the JDBC URL. For example:

`jdbc:sqlserver://abc123.us-east-1.a.s0.satoricyber.net;user=MyUserName;password=*****;encrypt=true;trustServerCertificate=false;...`

> **IMPORTANT NOTE:** Unsecured connections are not supported (non-SSL driver option)
>
> **DRIVER SUPPORT:** Satori support JDBC driver version 7.2 and higher, and you must ensure that you are using TLS version 1.2 and higher

### Connecting with the sqlcmd Command Line Utility

Please use version 15 or higher of Microsoft Command Line Utilities.

To connect to SQL Server using sqlcmd you must use the `-N` command line parameter to enable secured connection. For example:
`sqlcmd -S abc123-cluster-cajcpwqzmvbb.us-east-1.a.p0.satoricyber.net  -N -U john -P <john's password> -d <database name>`

### Connecting with the ODBC Driver

To connect with the ODBC driver, override the `server`, `database` and `password` parameters in the ODBC URL. For example:

`DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password + ';Encrypt=yes;TrustServerCertificate=no;`

Note: unsecured connections are not supported (non-SSL driver option)

### Connecting with Azure Data Studio

To Connect with Azure Data Studio, select **Create a Connection** with Server and set the Satori url, e.g.
`abc123.us-east-1.a.s0.satoricyber.net`
and enter user name and password.
Note: unsecured connections are not supported, to enable secure connectivity verify the following settings are applied:
- advanced->security->Always Encrypted to Enabled
- advanced->security->Encryption to true

### Connecting with Microsoft SQL Server Management Studio

To Connect with Microsoft SQL Server Management Studio, select **Connect to Database Engine** from **File Menu**, and **set Server name** to the **Satori url**, e.g.
`abc123.us-east-1.a.s0.satoricyber.net`

Select **Authentication** as **SQL Server Authentication** and enter **user name and password**.

> **NOTE**: unsecured connections are not supported, to enable secure connectivity verify the following settings are applied:
> - Options->Connection->checkbox _Encrypted connection_

### Connecting with Tableau Desktop

If you are attempting to use Microsoft Windows or Kerberos authentication against a MS SQL Server via Satori, ensure that you have the correct v17 ODBC driver from the Microsoft website:

[https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver16#version-17](https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver16#version-17)
