@@ -48,7 +48,16 @@ Param (
4848
4949 [string ]
5050 $CertDataFolder = " .\traefik\certs" ,
51-
51+
52+ [string ]
53+ $IdFolder = " .\id" ,
54+
55+ [string ]
56+ $SqlServerFolder = " .\mssql" ,
57+
58+ [string ]
59+ $SqlServerCertificatePassword = " Password12345" ,
60+
5261 [string ]
5362 $SpecificVersion
5463)
@@ -114,7 +123,11 @@ function Create-Certificates{
114123 [string ]$Topology ,
115124 [string ]$CdHost ,
116125 [string ]$CmHost ,
117- [string ]$IdHost
126+ [string ]$IdHost ,
127+ [string ]$IdFolder ,
128+ [string ]$MsSql ,
129+ [string ]$MsSqlFolder ,
130+ [string ]$MsSqlCertPswd
118131 )
119132
120133 Write-Information - MessageData " Starting create certificates for '$Topology ' topology..." - InformationAction Continue
@@ -134,7 +147,18 @@ function Create-Certificates{
134147 $rootKey = Create- RSAKey - KeyLength 4096
135148 $rootCertificate = Create- SelfSignedCertificate - Key $rootKey
136149 Create- CertificateFile - Certificate $rootCertificate - OutCertPath " $CertDataFolder \RootCA.crt"
137-
150+
151+ # Copy RootCA.crt into id\cert
152+ Copy-Item " $CertDataFolder \RootCA.crt" - Destination " $IdFolder \certs"
153+
154+ $securePswd = (ConvertTo-SecureString - String $MsSqlCertPswd - Force - AsPlainText)
155+ $signerCertificate = Import-CertificateForSigning - SignerCertificate $rootCertificate - SignerCertificatePassword $securePswd
156+
157+ # Create Sql Server Certificate and Key as PFX file
158+ $msSqlCertPath = [System.IO.Path ]::Combine((Get-Location ), " $MsSqlFolder \certs\$MsSql .pfx" )
159+ $mssqlCertificate = Create- SqlServerCertificate - CommonName $MsSql - DnsName $MsSql - SignerCertificate $signerCertificate
160+ Create- PfxFile - Certificate $mssqlCertificate - OutCertPath $msSqlCertPath - Password $securePswd
161+
138162 # Create Certificate and Key files for each Sitecore role
139163 $dnsNames | ForEach-Object {
140164 $selfSignedKey = Create- RSAKey
@@ -208,7 +232,7 @@ function InstallModule {
208232 Install-Module - Name $ModuleName - RequiredVersion $ModuleVersion - Repository $repository.Name - AllowClobber - AllowPrerelease - Scope CurrentUser - Force - ErrorAction " Stop"
209233 }
210234 $localModulePath = ((Get-Module $ModuleName - ListAvailable) | Where-Object Version -eq $ModuleVersion.Split (" -" )[0 ]).Path
211- Write-Host " Importing '$moduleName ' '$ModuleVersion ' from '$localModulePath ' ..."
235+ Write-Host " Importing '$ModuleName ' '$ModuleVersion ' from '$localModulePath ' ..."
212236 Import-Module - Name $localModulePath
213237 }
214238 finally {
@@ -244,6 +268,7 @@ function Invoke-ComposeInit {
244268 " SQL_SERVER" = $SqlServer
245269 " SQL_USERNAME" = $SqlUserName
246270 " SQL_PASSWORD" = $SqlSaPassword
271+ " SQL_TLS_CERTIFICATE_PASSWORD" = $SqlServerCertificatePassword
247272 " IS_ALWAYS_ENCRYPTED" = $IsAlwaysEncrypted
248273 " PROCESSING_ENGINE_TASKS_DATABASE_USERNAME" = $ProcessingEngineTasksDatabaseUserName
249274 " CD_HOST" = $CdHost
@@ -267,7 +292,7 @@ function Invoke-ComposeInit {
267292 Populate- EnvironmentFile - EnvFilePath $EnvFilePath - EnvVariablesTable $envVariablesTable
268293
269294 # Configure TLS/HTTPS certificates
270- $RootCertificateCreated = Create- Certificates - CertDataFolder $CertDataFolder - Topology $Topology - CdHost $CdHost - CmHost $CmHost - IdHost $IdHost
295+ $RootCertificateCreated = Create- Certificates - CertDataFolder $CertDataFolder - Topology $Topology - CdHost $CdHost - CmHost $CmHost - IdHost $IdHost - IdFolder $IdFolder - MsSql $SqlServer - MsSqlFolder $SqlServerFolder - MsSqlCertPswd $SqlServerCertificatePassword
271296
272297 # The update for the certs_config.yaml file is if Certificates were created for the custom hostnames.
273298 if ($RootCertificateCreated ){
0 commit comments