Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

3.7 KB
Raw Blame
---
title: "Microsoft SQL Server accounts"
sidebarTitle: "Microsoft SQL Server"
description: "Give people and agents access to a Microsoft SQL Server database without sharing its credentials."
---

A Microsoft SQL Server [account](/documentation/platform/pam/accounts/overview) stores the credentials for one SQL Server login or Windows user. Members connect to the database through the Infisical CLI, and Infisical records every query they run.

## Prerequisites

- The Admin [role](/documentation/platform/pam/concepts/access-control) on the [folder](/documentation/platform/pam/folders/overview) you'll add the account to
- A [gateway](/documentation/platform/gateways/overview) that can reach the database
- A Microsoft SQL Server [account template](/documentation/platform/pam/templates/overview)

## Create the account

<Steps>
  <Step>
    Go to **Privileged Access Management** > **Accounts** and select **Add Account**.
  </Step>
  <Step>
    Select the **Folder** and a Microsoft SQL Server **Account Template**, then select **Next**.
  </Step>
  <Step>
    Enter a **Name** and the connection details:

    | Field | Description |
    | --- | --- |
    | **Host** | The server's hostname or IP address |
    | **Port** | The server's port (defaults to `1433`) |
    | **Database** | The database that sessions connect to (defaults to `master`) |
    | **SSL Enabled** | Whether to connect over TLS |
    | **Reject Unauthorized** | Whether to reject a server certificate that can't be verified (shown when **SSL Enabled** is on) |
    | **SSL Certificate** | The CA certificate that signed the server's certificate (shown when **SSL Enabled** is on) |
  </Step>
  <Step>
    Select the **Auth Method** and enter the credentials:

    <Tabs>
      <Tab title="SQL Server Authentication">
        | Field | Description |
        | --- | --- |
        | **Username** | The SQL Server login |
        | **Password** | The login's password |
      </Tab>
      <Tab title="Windows Authentication (NTLM)">
        | Field | Description |
        | --- | --- |
        | **Username** | The Windows user |
        | **Password** | The user's password |
        | **Domain** | The user's Windows domain |
      </Tab>
      <Tab title="Windows Authentication (Kerberos)">
        | Field | Description |
        | --- | --- |
        | **Username** | The Windows user |
        | **Password** | The user's password |
        | **Realm** | The Kerberos realm, such as `CORP.EXAMPLE.COM` |
        | **KDC Address** | The address of the key distribution center (optional) |
        | **SPN** | The service principal name of the SQL Server instance, such as `MSSQLSvc/sql01.corp.example.com:1433` |
      </Tab>
    </Tabs>
  </Step>
  <Step>
    Select **Create**.
  </Step>
</Steps>

## Connect

To open a session, follow [Connect to an account](/documentation/platform/pam/accounts/connect). Microsoft SQL Server accounts don't support the browser, so use the CLI.

Start the local proxy:

```bash
infisical pam access analytics/reporting-db
```

The proxy keeps running in that terminal and prints its port. In a second terminal, connect your SQL Server client, such as `sqlcmd` or Azure Data Studio, to that port:

```bash
sqlcmd -S localhost,<port> -d analytics
```

The proxy signs in for you, so the client doesn't need a password.

## Next steps

<CardGroup cols={2}>
  <Card title="Microsoft SQL Server credential rotation" icon="refresh-cw" href="/documentation/platform/pam/credential-rotation/mssql">
    Rotate the passwords of Microsoft SQL Server accounts.
  </Card>
  <Card title="Sessions" icon="monitor" href="/documentation/platform/pam/sessions/overview">
    Review and end the connections that people and agents make to your accounts.
  </Card>
</CardGroup>