SQL change automation not display any output in Octopus deploy

Hello everyone, good day!

I’m seeking assistance with SQL change automation. Recently, we've encountered an issue where SCA isn't executing our script in Octopus Deploy. However, when I run the same script on our jump server, it works perfectly. Do you have any suggestions on how to resolve this? I'm sharing my code for executing SCA, along with some screenshots for reference.

Thank you!
Nestor





Sharing my script as well. 

# Azure specific; using SQL Credentials vs. integrated auth
$stepName = "CopyOver SCA DB Package - tenant";
$projectName = $OctopusParameters['Octopus.Project.Name'];
$currentRelease = $OctopusParameters['Octopus.Release.Number'];
$OutputPath = $OctopusParameters["Octopus.Action[$stepName].Output.Package.InstallationDirectoryPath"];
$TenantDBName = "#{DatabaseName}";
$SCAProjectName = "Database";
$DBStartDate=(GET-DATE)

Write-Host "projectName is $SCAProjectName";
Write-Host "Database Name is $TenantDBName";
  
& { 
# Since we're not using the cmdlets, and calling directly, we have to pass the '$UseWindowsAuth' along with the credentials
    
    # remove newer version of sql command 
    $env:Path = ($env:Path -split ";" | Where-Object { $_ -ne "C:\Program Files\SqlCmd\" }) -join ";"
    
    $UseWindowsAuth = $false
$DatabaseUserName = '#{SQLServerUsername}';
    $DatabasePassword = '#{SQLServerPassword}';
      
    $DatabaseServer="#{DatabaseServer}"; $DatabaseName=$TenantDBName; $ForceDeployWithoutBaseline="False"; $ReleaseVersion=$currentRelease;
    $Environment = "#{Octopus.Environment.Name}";
    & "$OutputPath\db\project\bin\Debug\Database_DeployPackage.ps1" 
}
$DBEndDate=(GET-DATE)
#display processing time with the current database with format of hh:mm:ss.
Write-Host ("Processed {1} with the duration of (hh:mm:ss) {0:c}" -f (NEW-TIMESPAN –Start $DBStartDate –End $DBEndDate), $TenantDBName)

Answers

Sign In or Register to comment.