Powershell script with sqlpackage publish action fails with no error

I have the below powershell script which runs from jenkins against windows server 2019 slave:

$sqlpackagepublish = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database Services.dacpac"',"/TargetConnectionString:""Data Source=${Env};Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;Initial catalog=${Target}""","/p:BlockOnPossibleDataLoss=${Data_loss}" -wait -PassThru -Credential $Cred -RedirectStandardOutput sqlstdout.txt -RedirectStandardError sqlstderr.txt

if ($sqlpackagepublish.ExitCode -eq 0) {
     Get-Content sqlstdout.txt
else {
     echo "An error occurred"
     Get-Content sqlstderr.txt
     exit $sqlpackagepublish.ExitCode

But the deploy fails with no error in sqlstderr.txt and no info in jenkins log. any idea how I can debug it?

I have modified the second line , try it now

I got this error after your change:

Wait-Job : The command cannot find a job with the job ID 10204. Verify the value of the Id parameter and then try the command again.
$sqlpackagepublish | Wait-Job
CategoryInfo : ObjectNotFound: (10204:Int32) [Wait-Job], PSArgumentException
FullyQualifiedErrorId : JobWithSpecifiedSessionNotFound,Microsoft.PowerShell.Commands.WaitJobCommand