Keyfactor Command Changing SQL Retry Settings

The SQL retry settings are found in the app settings configuration files for the Service, WebConsole, ClaimsProxy, WebAgentServices, KeyfactorAPIClosed An API is a set of functions to allow creation of applications. Keyfactor offers the Keyfactor API, which allows third-party software to integrate with the advanced certificate enrollment and management features of Keyfactor Command., and CAConnectorAPI applications and allow you to view or modify the configuration settings related to the connection to the SQL database. Any changes must be made to match for all applications.

Tip:  For SQL retry settings that apply to the SQL connection during the initial installation and configuration of Keyfactor Command, see Keyfactor Command Configuration Wizard Config File (for installations on Windows under IIS) and Install Keyfactor Command in Containers Under Kubernetes (for installations in containers under Kubernetes).
Windows Installations Under IIS

The settings for SQL retries are configured in the appsettings.json file in each of the Keyfactor Command program folders Service, WebConsole, ClaimsProxy, WebAgentServices, KeyfactorAPI, and CAConnectorAPI, located by default at:

C:\Program Files\Keyfactor\Keyfactor Platform\

To update the appsettings.json file for SQL configuration:

  1. Navigate to the \Configuration folder on your server for each of the Keyfactor Command program folders.
  2. Browse to open the appsettings.json file in a text editor (e.g. Notepad) and adjust the values as needed.
  3. Save the files.

Figure 462: Sample Appsettings.json File for SQL Retry Settings

Container Installations Under Kubernetes

The configurations from the appsettings.json file can be updated in one of two ways for container installations:

  • To update one or two settings, set an environment variable in your custom values file.

  • To update a large number of settings or the entire contents of the appsettings.json file, create a config map containing the appsettings.json file contents and mount it as a volume to replace the existing appsettings.json file.

Note:  Some appsettings.json settings are overridden by environment variables in a standard installation, so don’t assume that the values you see in an appsettings.json file if you view it within a started container are actually the values in use. Be sure to check for environment variables as well. Environment variables take precedence over values of the same name from the appsettings.json file. For example, in a standard installation, the appsettings.json files ActiveDirectoryEnforced value will show true, but an environment variable is set in each container where this is relevant to set this to false.
Tip:  Since the full appsettings.json configurations vary between applications, if you only wish to change the SQL retry settings, it’s probably best to use the environment variable approach rather than the full appsettings.json approach to avoid the need to replace the appsettings.json files for all of the applications affected by SQL retry settings. To provide full appsettings.json files, see the separate pages for each appsettings.json file.

To set an environment variable for one or two configuration values:

  1. On your Kubernetes server, edit your values file to add an additionalEnvironmentVariables section (if one does not already exist) and environment variable name(s) and value(s) for the setting(s) to change. For example, the following shows a portion of the example values file (see Install Keyfactor Command in Containers Under Kubernetes) with the SqlRetryConfiguration_NumberOfTries value set to 6 and the SqlRetryConfiguration_MaxTimeInterval value set to 00:02:30.

    additionalEnvironmentVariables:
      - name: SqlRetryConfiguration_NumberOfTries
        value: '6'
      - name: SqlRetryConfiguration_MaxTimeInterval
        value: '00:02:30'
    
    volumes:
      - name: root-cas
        configMap:
          name: ca-roots
          items:
            - key: ca-certificates.crt
              path: ca-certificates.crt
    volumeMounts:
      - name: root-cas
        mountPath: /etc/ssl/certs/ca-certificates.crt
        subPath: ca-certificates.crt
    Note:   Parameters are referenced by full name, including parent parameterClosed A parameter or argument is a value that is passed into a function in an application. name, if applicable. A SQL retry configuration setting would be, for example, SqlRetryConfiguration_NumberOfTries.
  2. Load the new values, referencing the deployment name, namespace, your customized values file, the helm chart, and version. For example:

    sudo helm upgrade Helm_Deployment_Name --namespace keyfactor-command --values values-local.yaml oci://repo.keyfactor.com/charts/command --version 1.0.0
Configuration Settings

The following table shows the configuration settings for SQL retry available in the Keyfactor Command Service, WebConsole, ClaimsProxy, WebAgentServices, KeyfactorAPI, and CAConnectorAPI appsettings.json files.

Table 95: Appsetting.json file - SQL Retry Parameters

Setting Description
Number Of Tries The number of times a connection attempt will be made to SQL before an exception is thrown. The default is 5.
Delta Time The preferred gap time to delay before the next attempt to connect to SQL will be made. The default is .5 (1/2) second.
Max Time Interval The maximum time interval before the next attempt to connect to SQL will be made. The default is 2 minutes.