Prerequisites

  1. Create a Microsoft SQL Server Connection with the required Secret Rotation permissions
  2. Create two designated database users for Infisical to rotate the credentials for. Be sure to grant each user login permissions for the desired database with the necessary privileges their use case will require.

An example creation statement might look like:

-- create server-level logins
CREATE LOGIN [infisical_user_1] WITH PASSWORD = 'my-password';
CREATE LOGIN [infisical_user_2] WITH PASSWORD = 'my-password';
GRANT CONNECT SQL TO [infisical_user_1];
GRANT CONNECT SQL TO [infisical_user_2];

-- create database-level users with login from above
USE my_database;
CREATE USER [infisical_user_1] FOR LOGIN [infisical_user_1];
CREATE USER [infisical_user_2] FOR LOGIN [infisical_user_2];

-- grant relevant permissions
GRANT SELECT, INSERT, UPDATE, DELETE ON SCHEMA::dbo TO [infisical_user_1];
GRANT SELECT, INSERT, UPDATE, DELETE ON SCHEMA::dbo TO [infisical_user_2];

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

Create a Microsoft SQL Server Credentials Rotation in Infisical

  1. Navigate to your Secret Manager Project’s Dashboard and select Add Secret Rotation from the actions dropdown.

  2. Select the Microsoft SQL Server Credentials option.

  3. Select the Microsoft SQL Server Connection to use and configure the rotation behavior. Then click Next.

  • Microsoft SQL Server Connection - the connection that will perform the rotation of the configured database user credentials.
  • Rotation Interval - the interval, in days, that once elapsed will trigger a rotation.
  • Rotate At - the local time of day when rotation should occur once the interval has elapsed.
  • Auto-Rotation Enabled - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.
  1. Input the usernames of the database users created above that will be used for rotation. Then click Next.
  • Database Username 1 - the username of the first user that will be used for rotation.
  • Database Username 2 - the username of the second user that will be used for rotation.
  1. Specify the secret names that the active credentials should be mapped to. Then click Next.
  • Username - the name of the secret that the active username will be mapped to.
  • Password - the name of the secret that the active password will be mapped to.
  1. Give your rotation a name and description (optional). Then click Next.
  • Name - the name of the secret rotation configuration. Must be slug-friendly.
  • Description (optional) - a description of this rotation configuration.
  1. Review your configuration, then click Create Secret Rotation.

  2. Your Microsoft SQL Server Credentials are now available for use via the mapped secrets.