Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tests | Fix RemoteCertificateNameMismatchErrorTest (ActiveIssue 31754)#3059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

MichelZ
Copy link
Contributor

This pull request includes significant changes to the configuration and testing of SQL Server certificates. The most important changes involve adding a PowerShell script to configure SQL Server certificates on Windows and updating tests to reflect these changes.

Configuration changes:

Test updates:

This is in addition to#3012 which activates other tests in this Class

@paulmedynskipaulmedynski requested a review froma teamMarch 18, 2025 14:41
@cheenamalhotra
Copy link
Member

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@codecovCodecov
Copy link

codecovbot commentedMar 19, 2025
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.18%. Comparing base(bb4c3b7) to head(88ad326).
Report is 97 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@##             main    #3059      +/-   ##==========================================- Coverage   72.68%   68.18%   -4.50%==========================================  Files         283      315      +32       Lines       58975    76136   +17161     ==========================================+ Hits        42864    51911    +9047- Misses      16111    24225    +8114
FlagCoverage Δ
addons?
netcore70.14% <ø> (-5.35%)⬇️
netfx67.37% <ø> (-3.77%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmedynskipaulmedynski self-assigned thisMar 21, 2025
@paulmedynskipaulmedynski added this to the6.1-preview1 milestoneApr 2, 2025
@mdaiglemdaigle self-assigned thisApr 2, 2025
@benrr101
Copy link
Contributor

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@benrr101
Copy link
Contributor

@edwardneal I know you were working on certificates and tests, can you give a bit of feedback on this one?

edwardneal reacted with thumbs up emoji

Comment on lines +222 to +229
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$($_.Value)\MSSQLServer\SuperSocketNetLib" -Name Certificate -Value $certificate.Thumbprint.ToLower()

# Grant read access to Private Key for SQL Service Account
if ($($_.Name) -eq "MSSQLSERVER") {
icacls $machineKeyPath /grant "NT Service\MSSQLSERVER:R"
} else {
icacls $machineKeyPath /grant "NT Service\MSSQL`$$($_.Name):R"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$($_.Value)\MSSQLServer\SuperSocketNetLib" -Name Certificate -Value $certificate.Thumbprint.ToLower()
# Grant read access to Private Key for SQL Service Account
if ($($_.Name) -eq "MSSQLSERVER") {
icacls $machineKeyPath /grant "NT Service\MSSQLSERVER:R"
} else {
icacls $machineKeyPath /grant "NT Service\MSSQL`$$($_.Name):R"
}
$serviceAccount = (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\$($_.Name)" -Name ObjectName).ObjectName
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$($_.Value)\MSSQLServer\SuperSocketNetLib" -Name Certificate -Value $certificate.Thumbprint.ToLower()
# Grant read access to Private Key for SQL Service Account
icacls $machineKeyPath /grant "$serviceAccount:R"

This will handle the case where SQL Server runs under a non-default account (CONTOSO\srv-mssql, etc.)

It'd be a little more PowerShell-centric to use the built-inGet-Acl andSet-Acl rather than shelling out toicacls, but that doesn't do anything different - the approach is fine.

Comment on lines +213 to +215
$store.open("MaxAllowed")
$store.add($certificate)
$store.close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We're going to add a new certificate to the Computer and to the Trusted Root Certificate Authorities certificate stores on every CI run. Depending how often the test agents are reprovisioned, we might bump intoKB2801679.

Another approach might be to iterate over the list of instances, then lazily generate a computer certificate if one is missing, then add the certificate to the Root store, then to add permissions over its machine key path.

@benrr101benrr101 merged commit7663524 intodotnet:mainApr 24, 2025
264 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@edwardnealedwardnealedwardneal left review comments

@mdaiglemdaiglemdaigle approved these changes

@paulmedynskipaulmedynskipaulmedynski approved these changes

Labels
None yet
Projects
None yet
Milestone
6.1-preview1
Development

Successfully merging this pull request may close these issues.

6 participants
@MichelZ@cheenamalhotra@benrr101@mdaigle@paulmedynski@edwardneal

[8]ページ先頭

©2009-2025 Movatter.jp