> ## Documentation Index
> Fetch the complete documentation index at: https://docs.less.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft SQL Server (MSSQL)

<Note>
  You need to make sure the Less IPs are whitelisted from your Microsoft SQL Server database. You can find the IPs [here](/guides/less-ip).
</Note>

### Setup

For most MSSQL databases, you can use the default **SQL username and password** connection method. However, if you are using a database that requires SSH, you can use the SSH connection method.

To connect to a MSSQL database, the easiest is to find your connection string. This is usually found in the database's settings (alternatively, ask your database admin for a connection string). It looks something like this:

```
Server=myServerAddress,1433;Database=myDataBase;User Id=myUsername;Password=myPassword;
```

Save those values for the steps below.

<Steps>
  <Step title="Account">
    The first step is input **server address**, **port** (almost always 1433), and the name of the **database** you want to extract data from.
  </Step>

  <Step title="Credentials">
    Select your **authentication type**:

    * **SQL username and password** (default) — use the **username** and **password** from your connection string. This works for SQL Server, Azure SQL Database with SQL authentication, and similar setups.
    * **Microsoft Entra Service Principal** — use the **client ID** and **client secret** from a Microsoft Entra app registration. Required for [Microsoft Fabric SQL Database](https://learn.microsoft.com/en-us/fabric/database/sql/authentication) and other Entra-only endpoints. See [How to create Entra Service Principal](/sources/guides/mssql-entra-service-principal).
  </Step>

  <Step title="SSH">
    We recommend trying without SSH first if you're in doubt. If you are using a database that requires SSH, you can use the SSH connection method.

    Input your **SSH host**, **SSH port**, **SSH username**, and **SSH password** from the database's settings.

    You can also choose to use a private key instead of a password. Just check the "I want to use an SSH Key" checkbox and upload your private key file.
  </Step>

  <Step title="Tables">
    Once you have input your account and credential information, you need to validate your connection on the Tables tab. Click "Connect" to continue. Note that we **do not** change error message coming from the database.

    If you can successfully connect to the database, you can now select the **tables** you want to extract data from. Alternatively, you can switch to the "query-based" tab to write one or more SQL queries to extract data from the database.

    <Warning>
      You can select either Table or Query-based. You cannot select both.
    </Warning>
  </Step>
</Steps>
