-
Notifications
You must be signed in to change notification settings - Fork 226
Closed
Closed
Copy link
Labels
testsThe issue or pull request is about tests only.The issue or pull request is about tests only.
Description
Problem Statement
Currently, the CI environment does not support encrypted connections to the SQL Server instance DSCSQLTEST. This limitation prevents us from testing encryption-related functionality and requires skipping tests that use the -Encrypt parameter.
Affected Areas
- Integration tests that require encrypted SQL Server connections
- Currently identified skipped test:
Invoke-SqlDscQuery.Integration.Tests.ps1line 165-169 - Additional tests across the project that may require encryption support
Technical Requirements
SQL Server Configuration
-
SSL Certificate Setup
- Install a valid SSL certificate on the SQL Server instance DSCSQLTEST
- Configure SQL Server to use the certificate for encrypted connections
- Options:
- Self-signed certificate (for CI testing purposes)
- CA-signed certificate (more secure, but may require additional setup)
-
SQL Server Instance Configuration
- Enable
Force Encryptionsetting in SQL Server Configuration Manager - Configure certificate binding in SQL Server Network Configuration
- Restart SQL Server service to apply changes
- Enable
CI Worker Configuration
-
Certificate Trust
- If using self-signed certificates, add them to the trusted certificate store
- Configure certificate chain validation for CI environment
-
Network Security
- Ensure TLS protocols are properly configured
- Verify firewall settings allow encrypted connections
Implementation Suggestions
Phase 1: Certificate Generation and Installation
# Example PowerShell script for CI setup
$cert = New-SelfSignedCertificate -DnsName "$(hostname)" -CertStoreLocation "Cert:\LocalMachine\My" -KeySpec KeyExchange
$thumbprint = $cert.Thumbprint
# Export certificate for SQL Server configuration
Export-Certificate -Cert $cert -FilePath "C:\temp\sqlserver.cer"
# Import to trusted root (for self-signed certificates)
Import-Certificate -FilePath "C:\temp\sqlserver.cer" -CertStoreLocation "Cert:\LocalMachine\Root"Phase 2: SQL Server Configuration
- Use SQL Server Configuration Manager or PowerShell/WMI to configure certificate
- Update registry settings for certificate binding
- Restart SQL Server services
Phase 3: Test Enablement
- Remove
-Skipattribute from encryption-dependent tests - Add comprehensive encryption testing scenarios
- Verify all parameter sets work with encrypted connections
Success Criteria
- SSL certificate properly configured for DSCSQLTEST instance
- Encrypted connections work in CI environment
- All previously skipped encryption tests are enabled and passing
- No regression in existing non-encrypted connection tests
References
- PR: Add integration test for Invoke-SqlDscQuery command #2256
- Comment: Add integration test for Invoke-SqlDscQuery command #2256 (comment)
- Requested by: @johlju
Additional Notes
This enhancement will improve test coverage and ensure encryption-related functionality works correctly across different SQL Server versions (2017, 2019, 2022) as indicated by the integration test tags.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testsThe issue or pull request is about tests only.The issue or pull request is about tests only.