dsccommunity / dsccommunity/SqlServerDsc

Refactor DSC_SqlSecureConnection private functions to public commands

Open
#2,304 0 comments 0 reactions 1 assignee View on GitHub

@johlju is already working on this.

Since Oct 12, 2025.

enhancement help wanted
Dominant language
PowerShell
Stars
385
Forks
224
PR merge metrics
No merged PRs in 30d

Description

Description

The integration test PostInstallationConfiguration.Integration.Tests.ps1 contains code that duplicates functionality from private functions in the DSC_SqlSecureConnection DSC resource. These private functions should be refactored into public commands to reduce code duplication and improve maintainability.

Private Functions to Refactor

The following private functions from source/DSCResources/DSC_SqlSecureConnection/DSC_SqlSecureConnection.psm1 should be converted to public commands:

Certificate Permission Management
  • Get-CertificateAcl - Gets the ACL of the certificate private key
  • Set-CertificatePermission - Grants service account read permissions to certificate private key
  • Test-CertificatePermission - Tests if service account has read permissions to certificate private key
SQL Server Encryption Registry Configuration
  • Get-SqlEncryptionValue - Gets the SQL Server SuperSocketNetLib registry path
  • Get-EncryptedConnectionSetting - Gets certificate thumbprint and ForceEncryption settings from registry
  • Set-EncryptedConnectionSetting - Sets certificate thumbprint and ForceEncryption in registry

Benefits

  1. Reduce code duplication - Integration tests can use public commands instead of duplicating logic
  2. Improve testability - Public commands can be unit tested independently
  3. Better reusability - Other scripts and modules can leverage these commands
  4. Simplified maintenance - Single source of truth for certificate and encryption configuration logic

Implementation Notes

  • Follow DSC Community naming conventions for public commands (e.g., Get-SqlDscCertificateAcl, Set-SqlDscCertificatePermission, etc.)
  • Add appropriate comment-based help with examples
  • Create unit tests for all new public commands
  • Update integration tests to use the new public commands
  • Update the DSC resource to use the new public commands
  • Add localized strings for any user-facing messages

References

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.