dsccommunity / dsccommunity/SharePointDsc

The connection string include "Host Name In Certificate=MYSQLSERVER" when I select encryption "Optional"

Open
#1,467 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
246
Forks
106
PR merge metrics
No merged PRs in 30d

Description

Problem description

With the last version 5.7.0 I set the value "DatabaseConnectionEncryption" to "Optional", the value "DatabaseServerCertificateHostName" with the same value than the CN of my SQL certificate.

When I enable the Session State with Enable-SPSessionStateService –DefaultProvision I have a new line in web.config of all Web App with a connectionstring who contains "Host Name In Certificate=MYSQLSERVER" and with this parameter I have an error 500, if I remove it it's working well but a timer job will re-add it.

If I create a farm with the GUI when I select "Optional" for the encryption I can't set a Database Server for the Certificate Host name then in connection string I don't have the part "Host Name In Certificate=MYSQLSERVER"

Verbose logs
Windows Event Id 1310 : 
    Exception message: Error parsing <sessionState> sqlConnectionString attribute: Keyword not supported: 'host name in certificate'.
DSC configuration
.
Suggested solution

Allow blank value for DatabaseServerCertificateHostName if DatabaseConnectionEncryption is Optional.
[ValidateNotNullOrEmpty()] must be removed for $DatabaseServerCertificateHostName parameter.

Replace line 344 by
if ($params.DatabaseConnectionEncryption -ne "Optional")
{
$returnValue.Add("DatabaseServerCertificateHostName", $ConnectionEncryption.DatabaseServerCertificateHostName)
}

I changed it in my server and now it's working well.

SharePoint version and build
SP SE with CU of October 2025
Operating system the target node is running
Windows 2022
PowerShell version and build the target node is running
.
SharePointDsc version
5.7.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the code around line 344 that builds the connection string and the DatabaseServerCertificateHostName parameter validation. Reproduce the Optional encryption case with Enable-SPSessionStateService –DefaultProvision, then verify that the generated connection string omits the certificate hostname and no longer triggers the reported sessionState parsing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.