Pipelines/Steps/Install/OnPrem/Sitecore/XP/Scaled/9.1/Install-CortexPRC.ps1

$ErrorActionPreference = "Stop"

Write-Error "Not Implemented..."

$prefix = $SAFConfiguration.prefix
$siteName = $SAFConfiguration.xConnect.cortexProcessingHostName
$hostNames = @($siteName)
$license = $SAFConfiguration.license
$sqlServer = $SAFConfiguration.sql.serverName
$sqlUser = $SAFConfiguration.sql.adminUsername
$sqlAdminPassword = $SAFConfiguration.sql.adminPassword
$sqlSitecorePassword = $SAFConfiguration.sql.sitecorePassword
$installDir = $SAFConfiguration.xConnect.installDir
$environment = $SAFConfiguration.xConnect.environment
$logLevel = $SAFConfiguration.xConnect.logLevel
$package = Get-ChildItem -Path "$SAFInstallPackageDir\*" -Include *cortexprocessing.scwdp.zip*
$sifConfiguration = GetSIFConfiguration -Name "xconnect-xp1-CortexProcessing.json" -ContextPath "$PSScriptRoot"

$clientCert = BuildSitecoreClientCertName -Prefix $prefix
$serverCert = BuildSitecoreServerCertName -Prefix $prefix

Write-Output "Install xConnect Cortex Processing started..."

# $dbs = @("$($prefix)_MarketingAutomation", "$($prefix)_Messaging", "$($prefix)_Processing.Pools", "$($prefix)_Xdb.Collection.Shard0", "$($prefix)_Xdb.Collection.Shard1", "$($prefix)_Xdb.Collection.ShardMapManager") MAYBE processingenging db
# DeleteDatabases -SqlServer $sqlServer -Databases $dbs -Username $sqlUser -Password $sqlAdminPassword

$sitecoreParams = @{
    Path = $sifConfiguration
    Package = $package.FullName
    LicenseFile = $license
    Sitename = $siteName
    SSLCert = $serverCert
    XConnectCert = $clientCert
    SqlDbPrefix = $prefix
    SqlAdminUser = $sqlUser
    SqlAdminPassword = $sqlAdminPassword
    SqlMessagingUser = "$($prefix)_messaginguser"
    SqlMessagingPassword = $sqlSitecorePassword
    SqlProcessingEngineUser = "$($prefix)_processingengineuser"
    SqlProcessingEnginePassword = $sqlSitecorePassword
    SqlReportingUser = "$($prefix)_reportinguser"
    SqlReportingPassword = $sqlSitecorePassword
    SqlServer = $sqlServer
    XConnectCollectionService = ""
    XConnectSearchService = ""
    XConnectEnvironment = $environment
    XConnectLogLevel = $logLevel
    MachineLearningServerUrl = ""
    MachineLearningServerBlobEndpointCertificatePath = ""
    MachineLearningServerBlobEndpointCertificatePassword = ""
    MachineLearningServerTableEndpointCertificatePath = ""
    MachineLearningServerTableEndpointCertificatePassword = ""
    MachineLearningServerEndpointCertificationAuthorityCertificatePath = ""
    InstallDirectory = $installDir
}
Install-SitecoreConfiguration @sitecoreParams
AddWebBindings -SiteName $siteName -HostNames $hostNames
AddWebBindings -SiteName $siteName -HostNames $hostNames -SSLCert $serverCert

Write-Output "Install xConnect Cortex Processing done."