0
votes

enter image description hereI am using SQL Server Database Deployment task in azure release pipeline to take back up of the database I need to set backup filename/path in a pipeline variable to use it in another task under a different deployment group in the same stage to restore the DB in case of any release error.

I already found a way to set variable value in "Run Inline powershell" task using ##vso[task.setvariable variable=variableName;]value

But for SQL Server Deployment task, i couldn't find anything as such. "Settable at release time" flag is turned ON for the variable.

Basically the requirement is to back up the Database and restore in case of any error in the DACPAC release. Please suggest a way to set the variable value in SQL Server Deployment task or any alternate way to achieve my requirement. I need the value of SQL variable @FullPath in a Pipeline Variable dynamically set during the release time.

1
Can you add a screen with tour task definition? Or YAML script if available?Krzysztof Madej
I have attached a screenshot, please let me know if you need any further clarify about the issue.Sreekanth Mohan

1 Answers

0
votes

You need to add powershell script step before an create there your FullPath. Then assign it to variable (you aready know syntax) and from know you can use this variable in all next tasks.

So in powershell step you need define this:

I'm not sure where did you get from @BackupPath but this also needs to be part below.

$fullPath=$(DataContextDbName)$(ClientNode).BAK
##vso[task.setvariable variable=YourFullPath;]$fullPath