Infisical supports connecting to Microsoft SQL Server using database principals.

Configure a Microsoft SQL Server Principal for Infisical

1

Create a Principal

Infisical recommends creating a designated server login and database user in your Microsoft SQL Server database for your connection.

-- Create login at the server level
CREATE LOGIN [infisical_app] WITH PASSWORD = 'my-password';

-- Grant server-level connect permission
GRANT CONNECT SQL TO [infisical_app];

-- If you intend to use Platform Managed Credentials (see below)
GRANT ALTER ANY LOGIN TO [infisical_app];

-- Switch to the specific database where you want to create the user
USE my_database;

-- Create the database user mapped to the login
CREATE USER [infisical_app] FOR LOGIN [infisical_app];
2

Grant Relevant Permissions

Depending on how you intend to use your Microsoft SQL Server connection, you’ll need to grant one or more of the following permissions.

To learn more about Microsoft SQL Server’s permission system, please visit their documentation.

For Secret Rotations, your Infisical user will require the ability to alter other logins’ passwords:

GRANT ALTER ANY LOGIN TO infisical_login;
3

Get Connection Details

You’ll need the following information to create your Microsoft SQL Server connection:

  • host - The hostname or IP address of your Microsoft SQL Server server
  • port - The port number your Microsoft SQL Server server is listening on (default: 1433)
  • database - The name of the specific database you want to connect to
  • username - The username of the login created in the steps above
  • password - The password of the login created in the steps above
  • sslCertificate (optional) - The SSL certificate required for connection (if configured)

If you are self-hosting Infisical and intend to connect to an internal/private IP address, be sure to set the ALLOW_INTERNAL_IP_CONNECTIONS environment variable to true.

Create Connection in Infisical

  1. Navigate to the App Connections tab on the Organization Settings page.

  2. Select the Microsoft SQL Server Connection option.

  3. Select the Username & Password method option and provide the details obtained from the previous section and press Connect to Microsoft SQL Server.

Optionally, if you’d like Infisical to manage the credentials of this connection, you can enable the Platform Managed Credentials option. If enabled, Infisical will update the password of the connection on creation to prevent external access to this database role.

  1. Your Microsoft SQL Server Connection is now available for use.