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

$ErrorActionPreference = "Stop"

$prefix = $SAFConfiguration.prefix
$siteName = $SAFConfiguration.xDB.automationReportingHostName
$hostNames = @($siteName)
$license = $SAFConfiguration.license
$sqlServer = $SAFConfiguration.sql.serverName
$sqlSitecorePassword = $SAFConfiguration.sql.sitecorePassword
$installDir = $SAFConfiguration.xDB.installDir
$environment = $SAFConfiguration.xConnect.environment
$logLevel = $SAFConfiguration.xConnect.logLevel
$package = Get-ChildItem -Path "$SAFInstallPackageDir\*" -Include *marketingautomationreporting.scwdp.zip*
$sifConfiguration = GetSIFConfiguration -Name "xconnect-xp1-MarketingAutomationReporting.json" -ContextPath "$PSScriptRoot"

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

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

$sitecoreParams = @{
    Path                           = $sifConfiguration
    Package                        = $package.FullName
    LicenseFile                    = $license
    Sitename                       = $siteName
    XConnectCert                   = $clientCert
    SSLCert                        = $serverCert
    SqlDbPrefix                    = $prefix
    SqlReferenceDataUser           = "$($prefix)_referencedatauser"
    SqlReferenceDataPassword       = $sqlSitecorePassword
    SqlMarketingAutomationUser     = "$($prefix)_marketingautomationuser"
    SqlMarketingAutomationPassword = $sqlSitecorePassword
    SqlServer                      = $sqlServer
    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 Reporting done."