[英]Set Azure Pipeline variable value in SQL Server Deployment task
I 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.我在 azure 发布管道中使用 SQL 服务器数据库部署任务来备份数据库 我需要在管道变量中设置备份文件名/路径,以便在同一阶段的不同部署组下的另一个任务中使用它来恢复数据库在任何发布错误的情况下。
I already found a way to set variable value in "Run Inline powershell" task using ##vso[task.setvariable variable=variableName;]value
我已经找到了一种使用##vso[task.setvariable variable=variableName;]value
在“运行内联 powershell”任务中设置变量值的方法
But for SQL Server Deployment task, i couldn't find anything as such.但是对于 SQL 服务器部署任务,我找不到任何类似的东西。 "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.基本上,要求是备份数据库并在 DACPAC 版本中出现任何错误时恢复。 Please suggest a way to set the variable value in SQL Server Deployment task or any alternate way to achieve my requirement.请提出一种在 SQL 服务器部署任务中设置变量值的方法或任何替代方法来满足我的要求。 I need the value of SQL variable @FullPath in a Pipeline Variable dynamically set during the release time.我需要在发布期间动态设置的管道变量中的 SQL 变量 @FullPath 的值。
You need to add powershell script step before an create there your FullPath.在创建 FullPath 之前,您需要添加 powershell 脚本步骤。 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:所以在 powershell 步骤中你需要定义这个:
I'm not sure where did you get from @BackupPath
but this also needs to be part below.我不确定你从@BackupPath
那里得到的,但这也需要在下面。
$fullPath=$(DataContextDbName)$(ClientNode).BAK
##vso[task.setvariable variable=YourFullPath;]$fullPath
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.