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

# Microsoft SQL Server

> Connect self-managed or cloud-managed Microsoft SQL Server so Oleria can discover logins, roles, permissions, and access paths across your databases.

Connect Microsoft SQL Server to Oleria to see every login, user, role, and permission across your databases. Oleria also flags risky configurations, such as an enabled `sa` login, `sysadmin` members, and logins that can impersonate any other login.

> [!NOTE]
>
> This integration supports self-managed SQL Server (VM or on-premises), AWS RDS for SQL Server, Azure SQL Database, Azure SQL Managed Instance, and Google Cloud SQL for SQL Server. Pick the setup path that matches your deployment below.

## What Oleria discovers

| Area | Detail |
| :- | :- |
| **Accounts** | Every login and database user: SQL logins, Windows users, members of Windows group logins, Microsoft Entra users, certificate and asymmetric-key logins, contained users, users without a login, orphaned users, application roles, and SQL Server Agent proxies. A database user mapped to a login is the same account as that login in every database. SQL Server has no email field, so Oleria synthesizes one for identity matching. |
| **Roles and groups** | Server roles (fixed, `##MS_…##`, and user-defined) and database roles (fixed and user-defined), including nesting, plus `public` and `guest`. Windows and Microsoft Entra group logins appear as groups. |
| **Resources** | The instance, databases, schemas, tables, views, procedures, functions, sequences, synonyms, linked servers, endpoints, availability groups, and SQL Server Agent jobs. Columns, certificates, keys, assemblies, and types appear when a permission is granted on them. |
| **Access grants** | Explicit `GRANT` and `DENY` at server, database, schema, object, and column scope. Also implicit access: fixed-role permissions (for example, `db_datareader` grants `SELECT`), ownership, and the access that `sysadmin` and `CONTROL SERVER` holders have to everything. A `DENY` overrides a `GRANT`. |
| **Impersonation** | `IMPERSONATE` on a login or user, `IMPERSONATE ANY LOGIN`, `sysadmin`, `db_owner`, and `EXECUTE AS` modules. Database-level impersonation reaches server-level identity only in `TRUSTWORTHY` databases. |
| **Risk signals** | See [Risk signals](#risk-signals) below. |
| **Activity** | SQL Server Audit events: sign-in success and failure, logout, password changes, account enable and disable, role membership changes, `GRANT`, `REVOKE`, and `DENY`, impersonation, schema changes, data access, and audit configuration changes. Requires SQL Server Audit configured for your deployment - see setup below. |

### Risk signals

Oleria reports these risks for SQL Server:

* **SQL Server sysadmin** - fixed `sysadmin` or `CONTROL SERVER`, including members of a Windows group login.
* **sa login enabled**
* **TRUSTWORTHY database owned by a sysadmin**
* **Can impersonate any login**
* **SQL login without password policy** (`CHECK_POLICY = OFF`)
* **SQL login password never expires** (`CHECK_EXPIRATION = OFF`)
* **SQL login password expired**
* **Orphaned database user**
* **guest enabled in a user database**
* **Permission granted WITH GRANT OPTION** - including members of a role that holds the permission.
* **Explicit grant to public** - excluding SQL Server's built-in defaults.

## Prerequisites

* A dedicated SQL Server login for Oleria, with the read permissions listed for your deployment below.
* Network access from Oleria to your instance on the configured port (default `1433`). Google Cloud SQL is the exception: Oleria connects through the Cloud SQL connector, so you don't need to allowlist IP addresses.
* Self-managed instances: SQL Server 2016 or later.
* Optional: additional permissions on that login, if you also want to run remediation actions. See [Remediation actions](#remediation-actions).

> [!NOTE]
>
> SQL Server silently hides catalog rows that a login can't see. A login without the read permissions below connects successfully but sees almost nothing. To avoid syncing a partial view, Oleria refuses the connection with an error that names the missing permission. Oleria re-checks permissions on every sync. If you later revoke them, the sync stops with an error instead of removing accounts and access from Oleria.

## Set up the integration

> [tab] Self-managed
>
> **1. Create a connector login**
>
> Connect as an administrator and create a dedicated login for Oleria. Set `CHECK_POLICY = ON` so the login follows your password policy.
>
> ```sql theme={null}
> CREATE LOGIN oleria_reader WITH PASSWORD = '<strong password>', CHECK_POLICY = ON;
> GRANT VIEW ANY DEFINITION TO oleria_reader;
> GRANT CONNECT ANY DATABASE TO oleria_reader;
> GRANT VIEW SERVER STATE TO oleria_reader;
> ```
>
> * `VIEW ANY DEFINITION` is required. It exposes all object and security metadata.
>
> * `CONNECT ANY DATABASE` is required, unless you create a user for the login in every database instead. If you do, also create one in every database you add later. When Oleria can't enter an online database, it refuses the connection, and a database added later breaks every sync until the login has a user there.
>
> * `VIEW SERVER STATE` is needed to read audit status for activity.
>
> * To read the audit files for activity, also grant `VIEW SERVER SECURITY AUDIT` (SQL Server 2022 and later) or `CONTROL SERVER` (2019 and earlier). Without it, Oleria still syncs access but shows no activity, and the **Activity** row on the integration's **Capabilities** tab shows **Needs permission**.
>
> > [!WARNING]
> >
> > SQL Server 2019 and earlier have no narrower permission for reading audit files. `CONTROL SERVER` is effectively `sysadmin`, so it turns a read-only connector into a privileged login, and Oleria reports that login as a risk. Use SQL Server 2022 or later if you can, or skip activity.
>
> > [!NOTE]
> >
> > `VIEW ANY SECURITY DEFINITION` alone isn't enough. It hides databases, schemas, and tables from the login.
>
> **2. Expand Active Directory groups (optional)**
>
> On a domain-joined instance, let Oleria expand the members of Windows group logins. Run this in the `master` database:
>
> ```sql theme={null}
> GRANT EXECUTE ON sys.xp_logininfo TO oleria_reader;
> ```
>
> Without this grant, Windows group logins still appear, but Oleria doesn't list their members.
>
> **3. Use Windows authentication (optional)**
>
> To connect with Windows authentication instead of a SQL login, create the login from a Windows account:
>
> ```sql theme={null}
> CREATE LOGIN [DOMAIN\svc_oleria] FROM WINDOWS;
> ```
>
> Then grant it the same permissions as above. Oleria supports two Windows authentication types:
>
> * **Windows authentication (NTLM)** uses the account's domain password.
> * **Windows authentication (Kerberos)** is for domains that turn NTLM off. Oleria needs the **Kerberos Realm** and the **Kerberos KDC** (your domain controllers, reachable from Oleria). The server's service principal name `MSSQLSvc/<host>:<port>` must be registered in Active Directory, so enter the server's Active Directory name as **Host**.
>
> **4. Read SQL Server Agent jobs and proxies (optional)**
>
> To inventory Agent jobs and proxies, run this in `msdb`. Without it, Oleria skips SQL Server Agent and syncs everything else:
>
> ```sql theme={null}
> USE msdb;
> CREATE USER oleria_reader FOR LOGIN oleria_reader;
> GRANT SELECT ON dbo.sysjobs TO oleria_reader;
> GRANT SELECT ON dbo.sysjobsteps (job_id, step_id, subsystem, proxy_id, database_name, database_user_name) TO oleria_reader;
> GRANT SELECT ON dbo.sysproxies TO oleria_reader;
> GRANT SELECT ON dbo.sysproxylogin TO oleria_reader;
> GRANT SELECT ON dbo.sysproxysubsystem TO oleria_reader;
> GRANT SELECT ON dbo.syssubsystems TO oleria_reader;
> ```
>
> Oleria never reads the job step `command` column, because it can hold passwords.
>
> **5. Enable SQL Server Audit for activity (optional)**
>
> Create and enable a server audit and a server audit specification. Follow [Set up SQL Server Audit](#set-up-sql-server-audit) below. Oleria reads the files of the enabled audit automatically.

> [tab] AWS RDS
>
> **1. Grant permissions to the connector login**
>
> Connect as the RDS master user and create a dedicated login. The RDS master user isn't a `sysadmin`, but it can grant these permissions.
>
> ```sql theme={null}
> CREATE LOGIN oleria_reader WITH PASSWORD = '<strong password>', CHECK_POLICY = ON;
> GRANT VIEW ANY DEFINITION TO oleria_reader;
> GRANT VIEW SERVER STATE TO oleria_reader;
> ```
>
> RDS doesn't allow granting `CONNECT ANY DATABASE`. Instead, create a user for the login in every database you want Oleria to see:
>
> ```sql theme={null}
> USE your_database;
> CREATE USER oleria_reader FOR LOGIN oleria_reader;
> ```
>
> **2. Find your instance endpoint**
>
> In the AWS console, open your RDS instance and copy the endpoint from **Connectivity & security**. You enter it as **Host** when you connect.
>
> > [!NOTE]
> >
> > Oleria verifies TLS against the Amazon RDS certificate authority. The **Trust Server Certificate** option isn't offered for RDS.
>
> **3. Enable SQL Server Audit for activity (optional)**
>
> 1. In the AWS console, add the `SQLSERVER_AUDIT` option to an option group for your SQL Server edition and version, then attach that option group to your instance. You don't need to restart the instance. Set the option's audit log retention to at least 24 hours: RDS keeps shipped audit files on the instance only for the retention time, and with a retention of 0 a file is deleted once RDS ships it, so its records never reach Oleria.
>
> 2. Create the server audit and specification as described in [Set up SQL Server Audit](#set-up-sql-server-audit). Use `D:\rdsdbdata\SQLAudit\` as the target path.
>
> 3. As the RDS master user, let the connector login read the audit. Only the master user can read it by default:
>
> ```sql theme={null}
> USE msdb;
> CREATE USER oleria_reader FOR LOGIN oleria_reader;
> GRANT SELECT ON dbo.rds_fn_get_audit_file TO oleria_reader;
> ```
>
> > [!WARNING]
> >
> > Without this grant, the sync still succeeds, but Oleria shows no activity. The **Activity** row on the integration's **Capabilities** tab shows **Needs permission**.
>
> Oleria reads the audit files from the instance with the built-in RDS reader function, `msdb.dbo.rds_fn_get_audit_file`. The instance keeps files only for the retention time you set. To keep activity from before that, use the optional S3 archive in the next step.
>
> > [!NOTE]
> >
> > Oleria excludes RDS's own automation login (`rdsa`) from activity.
>
> > [!NOTE]
> >
> > On a Multi-AZ instance, AWS doesn't replicate server audits and audit specifications to the secondary node. Recreate them there with the same name and GUID, or activity stops after a failover.
>
> **4. Read the S3 audit archive (optional)**
>
> RDS uploads completed audit files to the S3 bucket named in the `SQLSERVER_AUDIT` option. Oleria can read that bucket to show activity older than the instance keeps. To turn it on, select **Yes** for **Audit Archive in S3** when you connect. Oleria then opens an AWS CloudFormation link in a new tab:
>
> 1. Enter **AuditBucketName**, and **AuditBucketPrefix** if there is one, from the `S3_BUCKET_ARN` setting of the `SQLSERVER_AUDIT` option (`arn:aws:s3:::BUCKET/PREFIX`).
>
> 2. Create the stack. It creates an IAM role that only Oleria can assume, with your external ID. The role can list the bucket and read the objects under the prefix (`s3:ListBucket`, `s3:GetObject`), and describe the instances and option groups in your account (`rds:DescribeDBInstances`, `rds:DescribeOptionGroups`).
>
> 3. Copy the **RoleArn** from the stack's **Outputs** tab.
>
> You paste the Role ARN into Oleria in the second step of the connection form. See [Connect Microsoft SQL Server to Oleria](#connect-microsoft-sql-server-to-oleria). Reading the archive needs the RDS instance endpoint as **Host**.

> [tab] Azure SQL Database
>
> **1. Create a connector login**
>
> Run this in the `master` database of the logical server. You can create a SQL login, or a login for a Microsoft Entra application with `FROM EXTERNAL PROVIDER`.
>
> ```sql theme={null}
> CREATE LOGIN oleria_reader WITH PASSWORD = '<strong password>';
> ALTER SERVER ROLE ##MS_DefinitionReader## ADD MEMBER oleria_reader;
> ALTER SERVER ROLE ##MS_DatabaseConnector## ADD MEMBER oleria_reader;
> ALTER SERVER ROLE ##MS_LoginManager## ADD MEMBER oleria_reader;
> ```
>
> For a Microsoft Entra application, use `CREATE LOGIN [app-name] FROM EXTERNAL PROVIDER;` instead of the first statement, then add it to the same three roles.
>
> > [!WARNING]
> >
> > `##MS_LoginManager##` is required, because Azure SQL Database shows SQL logins only to login managers and to the server and Microsoft Entra admins. This role can also create and alter logins. Azure offers no read-only alternative. The server admin and the Microsoft Entra admin pass all checks without these roles.
>
> > [!NOTE]
> >
> > Server role assignments can take up to 5 minutes to apply. If Oleria refuses the connection right after you grant the roles, wait and try again.
>
> **2. Register an application (Microsoft Entra authentication, or reading activity)**
>
> Register an application in **Microsoft Entra ID** and create a client secret for it if you connect with a Microsoft Entra service principal, or if you want activity. Oleria reads Azure SQL Database activity as a Microsoft Entra service principal, even when you sign in to SQL with a SQL login. Note the tenant ID, client ID, and client secret. Oleria always requires encryption and verifies certificates with Microsoft Entra authentication.
>
> **3. Enable auditing for activity (optional)**
>
> In the connection form, **Activity Source** chooses where Oleria reads activity: **Log Analytics workspace**, **Audit storage container**, or **Don't collect activity**. Set up the one you choose:
>
> * **Log Analytics (recommended).** Complete these steps:
>
>   1. Enable server or database auditing with a **Log Analytics** destination.
>
>   2. In the diagnostic setting, choose the **Azure diagnostics** destination table, not **Resource specific**. Oleria reads the `SQLSecurityAuditEvents` category of the `AzureDiagnostics` table.
>
>   3. In the workspace, open **Access control (IAM)** and assign the application you registered the **Log Analytics Reader** role.
>
>   4. Copy the **Workspace ID** from the workspace's **Overview** page. You enter it as **Log Analytics Workspace ID** when you connect.
>
> * **Storage account.** Enable auditing to a storage account and note the container URL, in the form `https://ACCOUNT.blob.core.windows.net/<container>/<server>/`. You enter it as **Audit Storage URL** when you connect. Assign the application you registered the **Storage Blob Data Reader** role on the audit container. Oleria reads the audit files straight from storage as that application, so the SQL login needs no extra SQL permission, and you don't need to connect as the server admin.
>
> > [!NOTE]
> >
> > Azure's default audit policy records only `BATCH_COMPLETED_GROUP` (plus authentication), which gives one record per batch with its statement text, mapped to the database. Adding `SCHEMA_OBJECT_ACCESS_GROUP` gives table-level records, but it logs each statement a second time as a batch record. Choose one or the other. For typed events such as grants, role changes, and login changes, also add the matching action groups from the table in [Set up SQL Server Audit](#set-up-sql-server-audit).
>
> > [!NOTE]
> >
> > Azure SQL Database doesn't support Windows authentication. Neither Azure SQL Database nor Azure SQL Managed Instance supports `xp_logininfo` group expansion.

> [tab] Azure SQL Managed Instance
>
> **1. Create a connector login**
>
> Use the same login and grants as the **Self-managed** tab:
>
> ```sql theme={null}
> CREATE LOGIN oleria_reader WITH PASSWORD = '<strong password>', CHECK_POLICY = ON;
> GRANT VIEW ANY DEFINITION TO oleria_reader;
> GRANT CONNECT ANY DATABASE TO oleria_reader;
> GRANT VIEW SERVER STATE TO oleria_reader;
> ```
>
> To connect with a Microsoft Entra service principal, create the login with `FROM EXTERNAL PROVIDER` and grant it the same permissions.
>
> **2. Enable auditing for activity (optional)**
>
> Choose one destination for Azure SQL Managed Instance auditing:
>
> * **Log Analytics.** Use the same steps as the **Azure SQL Database** tab. The **Log Analytics Workspace ID** field appears only with **Microsoft Entra service principal** authentication, because Oleria reads the workspace as that application. The application needs the **Log Analytics Reader** role on the workspace.
>
> * **Storage account.** Create a server audit to a storage container (`TO URL`). Oleria finds the audit location itself, so there is nothing to enter. To read the files, the connector login needs `CONTROL SERVER`.
>
> > [!NOTE]
> >
> > Activity on Azure SQL Managed Instance hasn't been verified against a live instance yet. Treat it as best-effort until it is.

> [tab] Google Cloud SQL
>
> **1. Choose a connector login**
>
> Connect as the built-in `sqlserver` user, or create a dedicated login and grant it the same permissions as the **Self-managed** tab. SQL Server authentication and, with Managed Microsoft AD, Windows authentication (Kerberos) are available. With Kerberos, enter the instance's Active Directory FQDN as **Host** when you connect.
>
> If you create a dedicated login and want activity, also run this as the `sqlserver` user. Cloud SQL lets only `sqlserver` read the audit by default:
>
> ```sql theme={null}
> USE msdb;
> CREATE USER oleria_reader FOR LOGIN oleria_reader;
> GRANT SELECT ON dbo.gcloudsql_fn_get_audit_file TO oleria_reader;
> ```
>
> > [!WARNING]
> >
> > Without this grant, the sync still succeeds, but Oleria shows no activity. The **Activity** row on the integration's **Capabilities** tab shows **Needs permission**.
>
> **2. Note your Cloud SQL connection name**
>
> On the instance's **Overview** page, copy the **Connection name**. It's in `project:region:instance` format. Oleria connects through the Cloud SQL connector, so you don't need to allowlist IP addresses. It reaches the instance over its public IP, so an instance with only a private IP can't connect.
>
> **3. Create a service account**
>
> 1. In **IAM & Admin**, create a service account.
>
> 2. Make sure the **Cloud SQL Admin API** is enabled in the project, and grant the service account **Cloud SQL Client** (`roles/cloudsql.client`) on the project that contains the instance. Oleria's Cloud SQL connector uses this role to authorize the connection. Oleria reads the local audit files through the database connection. To also read the audit bucket, see the audit step below.
>
> 3. Create a JSON key for the service account and download it. You paste the entire file into the **GCP Service Account Key (JSON)** field. The field is required, because Oleria has no default Google credentials to fall back on.
>
> **4. Enable SQL Server Audit for activity (optional)**
>
> 1. Enable audit on the instance. Cloud SQL requires a Cloud Storage bucket for this:
>
> ```bash theme={null}
> gcloud sql instances patch <INSTANCE> --audit-bucket-path=gs://<bucket>
> ```
>
> 2. As the `sqlserver` user, create the server audit and specification as described in [Set up SQL Server Audit](#set-up-sql-server-audit). Cloud SQL requires the path `/var/opt/mssql/audit` and a `MAXSIZE` between 2 and 50 MB.
>
> 3. Optional: to keep activity beyond that, let Oleria read the bucket. Grant the service account **Storage Object Viewer** (`roles/storage.objectViewer`) on the bucket. Oleria finds the bucket from the instance's audit settings through the Cloud SQL Admin API, which **Cloud SQL Client** covers. If you want to name the bucket yourself, enter it as **Audit Bucket (optional)** when you connect.
>
> Oleria reads the audit with the built-in Cloud SQL reader function. Until you enable audit, Oleria shows no activity and doesn't report an error. The instance keeps its local audit files for 1 to 7 days (7 by default).
>
> > [!NOTE]
> >
> > Oleria excludes Cloud SQL's own management logins (`CloudDbSql…` connecting locally) from activity, though they appear as accounts. Cloud SQL Studio also connects as `sqlserver`. Oleria filters out its own sessions by application name.

### Set up SQL Server Audit

Complete this section only if you want Oleria to show activity. Activity appears within about 5 minutes of the event.

This section applies to self-managed SQL Server, AWS RDS, and Google Cloud SQL. Azure SQL Database and Azure SQL Managed Instance can't write audits to a local folder. Use the Azure auditing options in their setup tabs instead.

**1. Create the server audit**

Create an audit that writes to a file. Use `/var/opt/mssql/audit` on Google Cloud SQL, `D:\rdsdbdata\SQLAudit\` on AWS RDS, or any folder you choose on self-managed instances. Use these settings:

* `MAXSIZE = 50 MB`
* `QUEUE_DELAY = 1000`
* `ON_FAILURE = CONTINUE`

Name the audit `OleriaAudit`.

**2. Create the server audit specification**

Create a server audit specification named `OleriaAuditSpec` for `OleriaAudit`. Add the action groups in this table.

| Activity | Action groups |
| :- | :- |
| **Sign-in** | `SUCCESSFUL_LOGIN_GROUP`, `FAILED_LOGIN_GROUP`, `LOGOUT_GROUP`, `SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP`, `FAILED_DATABASE_AUTHENTICATION_GROUP`, `DATABASE_LOGOUT_GROUP` |
| **Passwords** | `LOGIN_CHANGE_PASSWORD_GROUP`, `USER_CHANGE_PASSWORD_GROUP`, `APPLICATION_ROLE_CHANGE_PASSWORD_GROUP` |
| **Identities** | `SERVER_PRINCIPAL_CHANGE_GROUP`, `DATABASE_PRINCIPAL_CHANGE_GROUP` |
| **Role membership** | `SERVER_ROLE_MEMBER_CHANGE_GROUP`, `DATABASE_ROLE_MEMBER_CHANGE_GROUP` |
| **Permissions** | `SERVER_PERMISSION_CHANGE_GROUP`, `SERVER_OBJECT_PERMISSION_CHANGE_GROUP`, `DATABASE_PERMISSION_CHANGE_GROUP`, `DATABASE_OBJECT_PERMISSION_CHANGE_GROUP`, `SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP` |
| **Ownership** | `SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP`, `DATABASE_OWNERSHIP_CHANGE_GROUP`, `DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP`, `SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP` |
| **Impersonation** | `SERVER_PRINCIPAL_IMPERSONATION_GROUP`, `DATABASE_PRINCIPAL_IMPERSONATION_GROUP` |
| **Schema and configuration** | `DATABASE_CHANGE_GROUP`, `DATABASE_OBJECT_CHANGE_GROUP`, `SCHEMA_OBJECT_CHANGE_GROUP`, `SERVER_OBJECT_CHANGE_GROUP` |
| **Data access** | `SCHEMA_OBJECT_ACCESS_GROUP`, `DATABASE_OBJECT_ACCESS_GROUP` |
| **Operations** | `SERVER_STATE_CHANGE_GROUP`, `SERVER_OPERATION_GROUP`, `DATABASE_OPERATION_GROUP`, `BACKUP_RESTORE_GROUP`, `DBCC_GROUP` |
| **Tampering** | `AUDIT_CHANGE_GROUP`, `TRACE_CHANGE_GROUP` |
| **Application events** | `USER_DEFINED_AUDIT_GROUP` |

> [!NOTE]
>
> The data access groups are what let Oleria show which tables an account reads or writes, tied to the table in your access graph. They also generate a high volume of events, so omit them only if you don't need that resource access activity. `BATCH_COMPLETED_GROUP` (SQL Server 2022 and later) is also available, but it is very high volume.

**3. Exclude the connector login (optional)**

To reduce audit volume, exclude the Oleria login from the audit. Run this before you turn the audit on, because SQL Server doesn't allow changing an enabled audit:

```sql theme={null}
ALTER SERVER AUDIT OleriaAudit WHERE server_principal_name <> 'oleria_reader';
```

This isn't required. Oleria already drops its own sessions when it reads the audit.

**4. Turn on the audit**

Enable the specification and the audit:

```sql theme={null}
ALTER SERVER AUDIT SPECIFICATION OleriaAuditSpec WITH (STATE = ON);
ALTER SERVER AUDIT OleriaAudit WITH (STATE = ON);
```

> [!NOTE]
>
> Oleria reads every enabled audit on the instance automatically, so there is no path to enter. The audit fields in the connection form are optional extras: **Audit Archive in S3** (AWS RDS), **Audit Storage URL** (Azure SQL Database storage auditing), and **Audit Bucket (optional)** (Google Cloud SQL).

## Connect Microsoft SQL Server to Oleria

**1. Open the integration**

Sign in to your Oleria workspace and navigate to **Integrations** -> **Microsoft SQL Server** -> **Connect**.

**2. Complete the connection form**

Select your **Deployment** first. The form updates to show only the fields that deployment needs.

> [tab] Self-managed
>
> | Field | Notes |
> | :- | :- |
> | **Deployment** | Select **Self-managed (VM or on-premises)**. |
> | **Host** | Required. The hostname or IP address of your SQL Server, reachable from Oleria. With Windows authentication (Kerberos), the server's Active Directory name. |
> | **Port** | Defaults to `1433`. |
> | **Initial Database** | Defaults to `master`. |
> | **Authentication** | **SQL Server authentication** (default), **Windows authentication (NTLM)**, **Windows authentication (Kerberos)**, or **Microsoft Entra service principal** (SQL Server 2022 with Microsoft Entra). |
> | **User** | Required for SQL Server and Windows authentication. The login you created above. For Windows authentication, use `DOMAIN\user` or `user@domain`. |
> | **Password** | Required for SQL Server and Windows authentication. |
> | **Kerberos Realm**, **Kerberos KDC** | Required for Kerberos. The Active Directory realm in upper case (for example `CORP.EXAMPLE.COM`), and your domain controllers as `host` or `host:port`, separated by commas. They must be reachable from Oleria. |
> | **Entra Tenant ID**, **Entra Client ID**, **Entra Client Secret** | Required for Microsoft Entra authentication. |
> | **Encryption** | **Required** (default), **Strict (TDS 8.0)**, **Login only**, or **Disabled (not recommended)**. Microsoft Entra authentication requires encryption. |
> | **Trust Server Certificate** | **No** (default) or **Yes**. Set to **Yes** only for self-signed certificates. It disables certificate verification. Not available with Microsoft Entra authentication. |
> | **Service Account Patterns (optional)** | Comma-separated `LIKE` patterns (`%` matches any text, `_` one character), for example `svc%`. Logins and database users whose names match appear as service accounts (non-human identities). Provider-managed logins and the connector's own login are detected automatically. |

> [tab] AWS RDS
>
> | Field | Notes |
> | :- | :- |
> | **Deployment** | Select **AWS RDS for SQL Server**. |
> | **Host** | Required. The instance endpoint from the RDS console. With Windows authentication (Kerberos), the `instance.domain` endpoint. |
> | **Port** | Defaults to `1433`. |
> | **Authentication** | **SQL Server authentication** (default), **Windows authentication (NTLM)**, or **Windows authentication (Kerberos)**, both with AWS Managed Microsoft AD. |
> | **User** | Required. The login you created above. |
> | **Password** | Required. |
> | **Kerberos Realm**, **Kerberos KDC** | Required for Kerberos. See the **Self-managed** tab. |
> | **Audit Archive in S3** | **No** (default) or **Yes**. **Yes** adds a second step. See the **Read the S3 audit archive** step on the **AWS RDS** tab above. |
> | **Service Account Patterns (optional)** | See the **Self-managed** tab. |
>
> If you select **Yes** for **Audit Archive in S3**, Oleria opens an AWS CloudFormation link in a new tab. Create the stack, then return to Oleria and provide:
>
> | Field | Notes |
> | :- | :- |
> | **Role ARN** | Required. The **RoleArn** output of the CloudFormation stack. |
> | **Confirm that the role is created using CloudFormation successfully** | Required checkbox. Select it once the stack is created. |
>
> Select **Authenticate**. Don't go back through the first step after you create the stack, because each pass generates a new external ID that an existing stack rejects. You can add the role only when you create the connection. After that, you can clear **Role ARN** to stop reading the archive.

> [tab] Azure SQL Database
>
> | Field | Notes |
> | :- | :- |
> | **Deployment** | Select **Azure SQL Database**. |
> | **Azure SQL Server Name** | Required. The logical server name. The host becomes `<name>.database.windows.net`. |
> | **Initial Database** | Defaults to `master`. |
> | **Authentication** | **SQL Server authentication** (default) or **Microsoft Entra service principal**. |
> | **User** and **Password** | Required for SQL Server authentication. |
> | **Entra Tenant ID**, **Entra Client ID**, **Entra Client Secret** | Required for Microsoft Entra authentication. |
> | **Activity Source** | **Log Analytics workspace** (default), **Audit storage container**, or **Don't collect activity**. |
> | **Entra Tenant ID**, **Entra Client ID**, **Entra Client Secret** (for reading audit) | Shown with SQL Server authentication when you collect activity. The Microsoft Entra service principal Oleria reads the audit as. |
> | **Log Analytics Workspace ID** | Shown for **Log Analytics workspace**. The workspace ID (a GUID). |
> | **Audit Storage URL** | Shown for **Audit storage container**. The container and the server's folder, for example `https://ACCOUNT.blob.core.windows.net/sqldbauditlogs/SERVER/`. |
> | **Service Account Patterns (optional)** | See the **Self-managed** tab. |

> [tab] Azure SQL Managed Instance
>
> | Field | Notes |
> | :- | :- |
> | **Deployment** | Select **Azure SQL Managed Instance**. |
> | **Host** | Required. The hostname of your managed instance. |
> | **Port** | Defaults to `1433`. |
> | **Initial Database** | Defaults to `master`. |
> | **Authentication** | **SQL Server authentication** (default) or **Microsoft Entra service principal**. |
> | **User** and **Password** | Required for SQL Server authentication. |
> | **Entra Tenant ID**, **Entra Client ID**, **Entra Client Secret** | Required for Microsoft Entra authentication. |
> | **Log Analytics Workspace ID** | Optional. Appears only with Microsoft Entra authentication. Reads auditing from this workspace as the service principal. |
> | **Service Account Patterns (optional)** | See the **Self-managed** tab. |

> [tab] Google Cloud SQL
>
> | Field | Notes |
> | :- | :- |
> | **Deployment** | Select **Google Cloud SQL for SQL Server**. |
> | **Cloud SQL Connection Name** | Required. In `project:region:instance` format. |
> | **GCP Service Account Key (JSON)** | Required. The entire JSON key file for the service account you created above. |
> | **Authentication** | **SQL Server authentication** (default) or **Windows authentication (Kerberos)** with Managed Microsoft AD. |
> | **User** | Required. `sqlserver` or the login you created above. |
> | **Password** | Required. |
> | **Host** | Shown for Kerberos only. The instance's Active Directory FQDN. |
> | **Kerberos Realm**, **Kerberos KDC** | Required for Kerberos. See the **Self-managed** tab. |
> | **Audit Bucket (optional)** | The Cloud Storage bucket the instance uploads audit files to (`gs://bucket` or `gs://bucket/path`), to read activity older than the instance keeps. Leave empty to read it from the instance's audit settings. The service account needs **Storage Object Viewer** on the bucket. |
> | **Service Account Patterns (optional)** | See the **Self-managed** tab. |

> [!NOTE]
>
> The **Encryption** and **Trust Server Certificate** options appear only for self-managed servers. For managed services, Oleria always requires encryption and verifies the certificate.

**3. Complete the connection**

Select **Authenticate**. Oleria validates the connection and its permissions, discovers your SQL Server accounts, resources, and access, and begins the first sync.

## Verify the integration

Confirm Microsoft SQL Server appears on the **Connected** tab of your Oleria **Integrations** page. After the first sync completes, you can review the discovered accounts, roles, resources, access grants, and activity in your Oleria workspace.

If the connection is refused with an error that names a missing permission, grant that permission to the connector login and try again.

## Remediation actions

Oleria validates the connector login's permissions before it runs each action. **Disable user accounts**, **Enable user accounts**, and **Revoke permission to resource instance** require approval in Oleria before they run. The **Capabilities** tab on the integration's page shows which actions the login can run.

| Action | What it does | Permission the connector login needs |
| :- | :- | :- |
| **Add user to role** | Adds a login to a server role, or the login's database user to a database role. Reversible. | `ALTER` on the role. A fixed server role needs `sysadmin` or membership in that role. A fixed database role needs `db_owner`. `securityadmin` and `db_securityadmin` cover only user-defined roles. |
| **Remove user from role** | Removes a login or database user from a role. Reversible. | The same as **Add user to role**. |
| **Disable user accounts** | Disables a login with `ALTER LOGIN … DISABLE`, or a contained database user with `DENY CONNECT` in each database where it exists, then ends its open sessions so access stops immediately. Reversible: Oleria can re-enable it. | `ALTER ANY LOGIN`, plus `ALTER ANY CONNECTION` and `VIEW SERVER STATE` to find and end the open sessions. On Azure SQL Database, `KILL DATABASE CONNECTION` and `VIEW DATABASE STATE` in `master` and in each database the login can reach, instead of those two. A contained database user needs `ALTER ANY USER` in its database. |
| **Enable user accounts** | Re-enables a disabled login or contained database user. Reversible. | `ALTER ANY LOGIN` for a login. `ALTER ANY USER` in its database for a contained database user. |
| **Revoke permission to resource instance** | Revokes an account's own direct `GRANT` on one securable. It never revokes a `DENY`, or access held through a role or `public`. Reversible: the revert grants it back. | Server scope: `CONTROL SERVER` or `securityadmin` (on Cloud SQL, `CustomerDbRootRole`). Database scope: `CONTROL` on the database or `db_securityadmin`. A linked server login mapping needs `ALTER ANY LOGIN`. |
| **Disable NHI accounts** | Disables a service-account login, a contained database user, or a SQL Agent proxy. Reversible. | The same as **Disable user accounts**. A SQL Agent proxy also needs `sysadmin`. |

Every action also refuses provider-managed logins, such as Cloud SQL `CloudDbSql…` logins, the RDS `rdsa` login, and `##MS_…##` logins.

> [!NOTE]
>
> Oleria never changes its own connector login or that login's role memberships. Oleria also refuses a name that matches more than one principal, which can happen with case-sensitive collations.

## Known limitations

* **No account creation or deletion:** Oleria assigns and removes roles, disables or re-enables logins and contained database users, and revokes permissions. It can't create or delete accounts.
* **Azure SQL Database sessions:** On Azure SQL Database, sessions belong to a database. Oleria can end them only with the database-level permissions listed above. Without them, **Disable user accounts** is refused rather than leaving sessions open.
* **Statement text is redacted:** Oleria removes data from audited statements and keeps their shape, such as keywords and table and column names. Oleria replaces literal values it recognizes - strings, numbers in value lists and comparisons, long numbers, emails, and comments - with `<redacted>`. The redaction is pattern-based, so a short number passed as a function argument can stay visible. Statement text is also capped at 500 characters.
* **Synthetic email:** SQL Server principals have no email field. Oleria synthesizes one, which may not match a real address. Windows and Microsoft Entra principals correlate through their directory identifiers, so they match your Active Directory and Microsoft Entra ID integrations.
* **Group membership:** Oleria expands the members of Windows group logins only on domain-joined instances where the connector login can run `xp_logininfo`. Cloud SQL always denies it. Microsoft Entra group membership comes from the Microsoft Entra ID integration, not from SQL Server.
* **DENY evaluation:** A member denied a permission doesn't inherit it from a role on the same object. A `DENY` at a broader scope, such as a schema, appears as its own denial. Oleria doesn't subtract it from a narrower grant, such as a table inside that schema.
* **Impersonation in non-TRUSTWORTHY databases:** Oleria shows it only for database-scoped accounts, because SQL Server confines it to that database.
* **System and provider databases:** `master`, `msdb`, `model`, `tempdb`, `rdsadmin*`, and `gcloud_cloudsqladmin` don't appear as resources. Oleria reads only SQL Server Agent's tables in `msdb`, and only if you grant them. On Cloud SQL, the `sqlserver` user can't grant the proxy tables, so Oleria shows Agent jobs but not proxies. On RDS, the master user can't grant the `msdb` tables either, and RDS supports only T-SQL job steps.
* **Offline or restoring databases:** Oleria lists them as skipped, with their state, and doesn't scan them.
* **Azure SQL Database login visibility:** Seeing SQL logins requires `##MS_LoginManager##`, which also allows login management. See the setup steps above.
* **Azure Log Analytics:** Oleria reads only the `AzureDiagnostics` table. Auditing set to the **Resource specific** destination table isn't supported.

## Contact us

For questions about this integration, contact us at [support@oleria.com](mailto:support@oleria.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.