@@ -50,7 +50,16 @@ Param (
5050
5151 [string ]
5252 $CertDataFolder = " .\traefik\certs" ,
53-
53+
54+ [string ]
55+ $IdFolder = " .\id" ,
56+
57+ [string ]
58+ $SqlServerFolder = " .\mssql" ,
59+
60+ [string ]
61+ $SqlServerCertificatePassword = " Password12345" ,
62+
5463 [string ]
5564 $SpecificVersion
5665)
@@ -116,7 +125,11 @@ function Create-Certificates{
116125 [string ]$Topology ,
117126 [string ]$CdHost ,
118127 [string ]$CmHost ,
119- [string ]$IdHost
128+ [string ]$IdHost ,
129+ [string ]$IdFolder ,
130+ [string ]$MsSql ,
131+ [string ]$MsSqlFolder ,
132+ [string ]$MsSqlCertPswd
120133 )
121134
122135 Write-Information - MessageData " Starting create certificates for '$Topology ' topology..." - InformationAction Continue
@@ -136,7 +149,18 @@ function Create-Certificates{
136149 $rootKey = Create- RSAKey - KeyLength 4096
137150 $rootCertificate = Create- SelfSignedCertificate - Key $rootKey
138151 Create- CertificateFile - Certificate $rootCertificate - OutCertPath " $CertDataFolder \RootCA.crt"
139-
152+
153+ # Copy RootCA.crt into id\cert
154+ Copy-Item " $CertDataFolder \RootCA.crt" - Destination " $IdFolder \certs"
155+
156+ $securePswd = (ConvertTo-SecureString - String $MsSqlCertPswd - Force - AsPlainText)
157+ $signerCertificate = Import-CertificateForSigning - SignerCertificate $rootCertificate - SignerCertificatePassword $securePswd
158+
159+ # Create Sql Server Certificate and Key as PFX file
160+ $msSqlCertPath = [System.IO.Path ]::Combine((Get-Location ), " $MsSqlFolder \certs\$MsSql .pfx" )
161+ $mssqlCertificate = Create- SqlServerCertificate - CommonName $MsSql - DnsName $MsSql - SignerCertificate $signerCertificate
162+ Create- PfxFile - Certificate $mssqlCertificate - OutCertPath $msSqlCertPath - Password $securePswd
163+
140164 # Create Certificate and Key files for each Sitecore role
141165 $dnsNames | ForEach-Object {
142166 $selfSignedKey = Create- RSAKey
@@ -246,6 +270,7 @@ function Invoke-ComposeInit {
246270 " SQL_SERVER" = $SqlServer
247271 " SQL_USERNAME" = $SqlUserName
248272 " SQL_PASSWORD" = $SqlSaPassword
273+ " SQL_TLS_CERTIFICATE_PASSWORD" = $SqlServerCertificatePassword
249274 " IS_ALWAYS_ENCRYPTED" = $IsAlwaysEncrypted
250275 " PROCESSING_ENGINE_TASKS_DATABASE_USERNAME" = $ProcessingEngineTasksDatabaseUserName
251276 " CD_HOST" = $CdHost
@@ -269,7 +294,7 @@ function Invoke-ComposeInit {
269294 Populate- EnvironmentFile - EnvFilePath $EnvFilePath - EnvVariablesTable $envVariablesTable
270295
271296 # Configure TLS/HTTPS certificates
272- $RootCertificateCreated = Create- Certificates - CertDataFolder $CertDataFolder - Topology $Topology - CdHost $CdHost - CmHost $CmHost - IdHost $IdHost
297+ $RootCertificateCreated = Create- Certificates - CertDataFolder $CertDataFolder - Topology $Topology - CdHost $CdHost - CmHost $CmHost - IdHost $IdHost - IdFolder $IdFolder - MsSql $SqlServer - MsSqlFolder $SqlServerFolder - MsSqlCertPswd $SqlServerCertificatePassword
273298
274299 # The update for the certs_config.yaml file is if Certificates were created for the custom hostnames.
275300 if ($RootCertificateCreated ){
0 commit comments