dsccommunity / dsccommunity/SqlServerDsc
Refactor DSC_SqlSecureConnection private functions to public commands
Open
@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 keySet-CertificatePermission- Grants service account read permissions to certificate private keyTest-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 pathGet-EncryptedConnectionSetting- Gets certificate thumbprint and ForceEncryption settings from registrySet-EncryptedConnectionSetting- Sets certificate thumbprint and ForceEncryption in registry
Benefits
- Reduce code duplication - Integration tests can use public commands instead of duplicating logic
- Improve testability - Public commands can be unit tested independently
- Better reusability - Other scripts and modules can leverage these commands
- 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
- PR: https://github.com/dsccommunity/SqlServerDsc/pull/2303
- Comment: https://github.com/dsccommunity/SqlServerDsc/pull/2303#discussion_r2423795837
- Requester: @johlju
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.