I need that the post deploy script, part of the database project, to set some specific things depending on the environment it will run.
How pass an environment variable that the script can access?
Here what i'm trying to do. the yaml file:
- task: SqlDacpacDeploymentOnMachineGroup@0
displayName: Install database
inputs:
TaskType: 'dacpac'
DacpacFile: '**/app-db.dacpac'
TargetMethod: 'server'
ServerName: '(localdb)\MSSQLLocalDB'
DatabaseName: 'app-dev'
AuthScheme: 'windowsAuthentication'
The log:
Starting: Install database
==============================================================================
Task : SQL Server database deploy
Description : Deploy a SQL Server database using DACPAC or SQL scripts
Version : 0.3.23
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/sql-dacpac-deployment-on-machine-group
==============================================================================
*** Could not deploy package.
Warning SQL72013: The following SqlCmd variables are not defined in the target scripts: env.
Error SQL72014: .Net SqlClient Data Provider: Msg 137, Level 15, State 2, Line 14 Must declare the scalar variable "@env".
Error SQL72045: Script execution error. The executed script:
IF (@env = 'DEV')
BEGIN
...
END