Pipelines/Steps/Install/OnPrem/Sitecore/XP/Scaled/9.0/Install-AutomationOperations.ps1

$ErrorActionPreference = "Stop"

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

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

Write-Output "Install xDB Automation Operations started..."

$sitecoreParams = @{
    Path                           = $sifConfiguration
    Package                        = $package.FullName
    LicenseFile                    = $license
    Sitename                       = $siteName
    XConnectCert                   = $clientCert
    SSLCert                        = $serverCert
    SqlDbPrefix                    = $prefix
    SqlAdminUser                   = $sqlUser
    SqlAdminPassword               = $sqlAdminPassword
    SqlCollectionUser              = "$($prefix)_collectionuser"
    SqlCollectionPassword          = $sqlSitecorePassword
    SqlProcessingPoolsUser         = "$($prefix)_processingpoolsuser"
    SqlProcessingPoolsPassword     = $sqlSitecorePassword
    SqlMarketingAutomationUser     = "$($prefix)_marketingautomationuser"
    SqlMarketingAutomationPassword = $sqlSitecorePassword
    SqlReferenceDataUser           = "$($prefix)_referencedatauser"
    SqlReferenceDataPassword       = $sqlSitecorePassword
    SqlMessagingUser               = "$($prefix)_messaginguser"
    SqlMessagingPassword           = $sqlSitecorePassword
    SqlServer                      = $sqlServer
    XConnectCollectionService      = $collectionService
    XConnectReferenceDataService   = $referenceDataService
    XConnectEnvironment            = $environment
    XConnectLogLevel               = $logLevel
    InstallDirectory               = $installDir
}
Install-SitecoreConfiguration @sitecoreParams
AddWebBindings -SiteName $siteName -HostNames $hostNames
AddWebBindings -SiteName $siteName -HostNames $hostNames -SSLCert $serverCert

Write-Output "Install xDB Automation Operations done."