# Microsoft SQL Server

{% hint style="info" %}
You can also use this document to connect **Azure SQL Server** to Decube.
{% endhint %}

## Supported Capabilities

{% tabs %}
{% tab title="Supported Capabilities" %}
**General**

* **Metadata** — metadata extraction and display of asset information (tables, columns, schemas). Types collected: Schema, Table, Column
* **Profiling** — data profiling on the Profiler tab
* **Preview** — sample data preview
* **Data Quality** — data quality monitoring and observability

**Data Quality Monitors**

* Freshness
* Volume
* Field Health
* Custom SQL
* Schema Drift

**Lineage**

* **Foreign Key Lineage** — tracks relationships between tables via primary and foreign keys
  {% endtab %}

{% tab title="Not Supported" %}
**General**

* Configurable Collection
* External Table
* View Table
* Stored Procedure

**Data Quality Monitors**

* Job Failure

**Lineage**

* View Table Lineage
* External Table Lineage
* SQL Query Lineage
* Stored Procedure Lineage
  {% endtab %}
  {% endtabs %}

## Connection Requirements

Connecting to decube is as easy as providing us with credentials to your Microsoft SQL database. At a minimum, we require

* `username`
  * If connecting to AzureSQL using SSH, use `username@<servername>.database.windows.net`
* `password`
* `host address`
  * If connecting to AzureSQL, use fully qualified name e.g. `<servername>.database.windows.net`
* `host port`
* `database name`

<figure><img src="https://1779874722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTw0qpCVzfrIXqS4FEg4T%2Fuploads%2Fgit-blob-56816bf2ca0e0ef44e456a7c19f83a404106079d%2Fimage.png?alt=media" alt=""><figcaption><p>Microsoft SQL Server</p></figcaption></figure>

The `source name` will be for you to differentiate and recognize particular sources within the decube application.

We strongly encourage you to create a decube **read-only** user for this credential purpose, which you can follow [here](https://github.com/DecubeIO/decube_docs/blob/master/databases/mssql.md#custom-user-for-decube).

### **Security Concerns**

If access to your database is protected by security measures, we allow for connecting via [SSH Tunneling](https://docs.decube.io/how-to-connect-data-sources/enabling-vpc-access/ssh-tunneling) or you could [whitelist our IP](https://docs.decube.io/how-to-connect-data-sources/enabling-vpc-access/ip-whitelisting). See more [here.](https://docs.decube.io/how-to-connect-data-sources/enabling-vpc-access)

{% hint style="info" %}
To connect to Azure SQL through an SSH tunnel, you must explicitly provide the server context. Azure's gateway requires the following configuration to route the request correctly:

* Host: Use the fully qualified domain name: `<servername>.database.windows.net`.
* Username: Use the format `username@<servername>.database.windows.net`.
  {% endhint %}

### **Custom User for decube**

A custom user would allow for a granular configuration of the user on your database and your connection to decube.

1. Create a New User for decube

```sql
CREATE LOGIN [decube] WITH PASSWORD=N'your_password';
```

2. Execute the following SQL statement to create a new database user and map it to the login created in the previous step

```sql
USE your_db_name;
CREATE USER [decube] FOR LOGIN [decube];
```

3. Add the user to role db\_datareader

```sql
EXEC sp_addrolemember N'db_datareader', N'decube'
```
