Configuring the Business Central Database

For a Business Central Server instance to connect to and access a database in SQL Server, the server instance must be authenticated by the database. As in SQL Server, Business Central supports two authentication modes for database communication: Windows Authentication and SQL Server Authentication. When you set up Business Central, you must ensure that database authentication is configured correctly on both the server instance and database, otherwise the server instance will not be able to connect to the database. By default, Windows Authentication is configured on the server instance and database. With Windows Authentication the Business Central Setup does the work for you.

This article describes how to configure SQL Server Authentication. You perform the configuration in two places: on the databases in SQL Server and on the Business Central Server instance. The procedure is different when the Business Central Server instance is configured as a multitenant server instance than when it is not a multitenant server instance.

Set Up an Encryption Key

When using SQL Server authentication, Business Central requires an encryption key to encrypt the credentials (user name and password) that the Business Central Server instance uses to connect to the Business Central database in SQL Server. The encryption key must be installed on the computer where the Business Central Server is installed and also in the database in SQL Server. In a multitenant deployment, the encryption key must be installed in the application database.

To set up an encryption key, you can use one of the following methods:

  • You can create and import your own encryption key by using Business Central Administration Shell cmdlets, as described in the following procedure.

  • If you are configuring SQL Server authentication on a Business Central Server instance for the first time, you can use the Business Central Server Administration tool which can automatically create and install a system encryption key. If you decide to use this method, no action is required.

Create and import encryption key

  1. In the Business Central Administration Shell, run the New-NAVEncryptionkey cmdlet.

    This creates a file that contains an encryption key. If you already have an encryption key file, you can skip this step.

  2. Run the Import-NAVEncryptionkey cmdlet to install the encryption key on the Business Central Server instance and database.

On the computer running the Business Central Server instance, the encryption key file has the name BC160.key and is stored in the %systemroot%\ProgramData\Microsoft\Microsoft Dynamics NAV\[version]\Server\Keys. In the database, the encryption key is registered in the dbo.$ndo$publicencryptionkey table. In a multitenant deployment, the encryption key is registered in the application database.

Configure SQL Authentication on the Database

This section describes how to configure a Business Central database to use SQL Server Authentication with a Business Central Server instance. You can complete the steps in this procedure by using SQL Server Management Studio or Transact-SQL.

Important

In a deployment where the Business Central Server instance is configured as a multitenant server instance, you must complete the following procedure on the application database and tenant database.

Configure SQL Server Authentication on the database in SQL Server

  1. Configure the SQL Server instance (Database Engine) that hosts the Business Central database to use SQL Server Authentication.

    To use SQL Server authentication, you configure the database instance to mixed authentication mode (SQL Server and Windows Authentication). For more information, see Change Server Authentication Mode.

  2. In the SQL Server instance, create a login that uses SQL Server authentication.

    For more information, see Create a Login.

  3. Map the login to a user in the Business Central database, and give the user the relevant privileges in the Business Central database.

    For more information, see Create a Database User in the SQL Server docs and the Giving the service account database privileges in SQL Server in the current article.

Configure SQL Server Authentication on the Business Central Instance (Non-Multitenant)

You configure the Business Central Server instance with the login credentials (user name and password) of the user account in the Business Central database in SQL Server that you want to use for authentication. You can do this using the Business Central Server Administration tool or Business Central Administration Shell.

Configure SQL Authentication on a server instance using Business Central Server Administration tool

  1. Open the Business Central Server Administration tool.

  2. In the console tree, which is the left pane, expand the node for the computer that contains the Business Central Server instance, and then select the Business Central Server instance.

  3. In the Actions pane, choose Database Credentials.

  4. On the Database Credentials page, choose the Edit button.

  5. Set the Database Authentication Type to SQL Authentication.

  6. In the Database User Name field, type the login name for the database user that you want to use to access the Business Central database in SQL Server.

  7. In the Password field, type the login password for the database user that you want to use to access the Business Central database in SQL Server.

  8. Choose the Save button, and then on the Enable Encryption on SQL Server Connections dialog box, choose the OK button.

    Encryption keys are used to help secure the login credentials over the connection between the Business Central Server instance and the Business Central database in SQL Server.

  9. On the Information dialog box about encryption, choose the OK button.

    This dialog box is to inform you to enable encryption on SQL Server connections, which is disabled by default.

  10. If you want to enable encryption on SQL Server connections, in the Action pane, choose Configuration, and then choose the Edit button. In the Database tab, select Enable Encryption on SQL Connections, choose the Save button, and then the OK button.

  11. Restart the server instance.

Configure SQL Authentication on a server instance using Business Central Administration Shell

  • If you are modifying an existing Business Central Server instance, run the Set-NAVServerConfiguration cmdlet.

    Use the DatabaseCredentials parameter to provide the login credentials of the database user that you want to use to access the application database.

  • If you are creating a new Business Central Server instance, run the New-NAVServerInstance cmdlet.

    Use the DatabaseCredentials parameter to provide the login credentials of the database user that you want to use to access the application database.

Configure SQL Server Authentication on Business Central Instance in a Multitenant Deployment

This section describes how to configure a Business Central database to use SQL Server Authentication with a Business Central Server instance. You can complete the steps in this procedure by using SQL Server Management Studio or Transact-SQL.

To configure a SQL Server Authentication on a Business Central Server instance, you set up the server instance with the login credentials (user name and password) for the user accounts for the application and tenant databases in SQL Server. You can do this using the Business Central Server Administration tool or Business Central Administration Shell.

Configure SQL Authentication using Business Central Server Administration tool

  1. Open the Business Central Server Administration tool.

  2. In the console tree, which is the left pane, expand the node for the computer that contains the Business Central Server instance, and then select the Business Central Server instance.

  3. Configure SQL Server Authentication with the application database as follows:

    1. In the Actions pane, choose Database Credentials.

    2. On the Database Credentials page, choose the Edit button.

    3. Set the Database Authentication Mode to SQL Server Authentication.

    4. In the Database User Name field, type the login name for the database user that you want to use to access the Business Central application database in SQL Server.

    5. In the Password field, type the login password for the database user that you want to use to access the Business Central database in SQL Server.

    6. Choose the Save button, and then on the Enable Encryption on SQL Server Connections dialog box, choose the OK button.

      Encryption keys are used to help secure the login credentials over the connection between the Business Central Server instance and the Business Central database in SQL Server.

    7. On the Information dialog box about encryption, choose the OK button.

      This dialog box is to inform you to enable encryption on SQL Server connections, which is disabled by default.

    8. If you want to enable encryption on SQL Server connections, in the Action pane, choose Configuration, and then choose the Edit button. In the Database tab, select Enable Encryption on SQL Connections, choose the Save button, and then the OK button.

  4. To configure SQL Server Authentication with the tenant database, mount the tenant to the Business Central Server instance and specify the login credentials (user name and password) for the database user that you want to use to access the Business Central tenant database in SQL Server.

    If the tenant is already mounted to the Business Central Server instance, you must dismount the tenant, and mount it again.

    For more information see Mount or Dismount a Tenant.

  5. Restart the server instance.

Configure SQL Authentication using Business Central Administration Shell

  1. Configure SQL Server Authentication with the application database as follows:

    • If you are modifying an existing Business Central Server instance, run the Set-NAVServerConfiguration cmdlet.

      Use the DatabaseCredentials parameter to provide the login credentials of the database user that you want to use to access the application database.

    • If you are creating a new Business Central Server instance, run the New-NAVServerInstance cmdlet.

      Use the DatabaseCredentials parameter to provide the login credentials of the database user that you want to use to access the application database.

  2. To configure SQL Authentication with the tenant database, run the Mount-NAVTenant cmdlet.

    Use the DatabaseCredentials parameter to provide the login credentials of the database user that you want to use to access the tenant database.

See Also

Installation Considerations for Microsoft SQL Server
Deployment
Installing Business Central Using Setup