I am working on a SQL Server project in Visual Studio that contains SQLCMD variables. When attempting to deploy it as a DACPAC, I encounter an error message. The pipeline defines a variable named ‘MemOptimizedPath’, and I am using the task SqlDacpacDeploymentOnMachineGroup@0 for the deployment process. It’s worth noting that the DACPAC builds correctly during the build task. How can I substitute the SQLCMD variables with the pipeline variables during the deployment in the pipeline?
jobs:
- job: DeployDatabase
displayName: 'Deploy Red and Yellow Databases'
pool: '<pool>'
variables:
MemOptimizedPath: 'H:\SQLData\TestDatabaseMemoryOptimized'
steps:
- task: DownloadBuildArtifacts@1
inputs:
buildType: current
downloadType: single
artifactName: 'drop'
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: SqlDacpacDeploymentOnMachineGroup@0
displayName: 'Deploy Database'
inputs:
TaskType: dacpac
DacpacFile: '**/*.dacpac'
TargetMethod: connectionString
ConnectionString: '${{ variables.yellowConnectionString }}'