Forum Discussion

VeronikaHolcnerova's avatar
VeronikaHolcnerova
Copper Contributor
Feb 26, 2024

Azure DevOps pipeline - how to deploy DB project to on-prem using custom path to SqlPackage.exe

Hi, 

 

I've been trying to figure this out for a while, but can't find my way around it. 

 

Our DevOps team has the SqlPackage.exe file saved in a custom location on a virtual machine used for the agents. I need to access the file to be able to deploy DB projects to on-premise server using Azure DevOps pipeline. 

 

I tried couple different approaches, but nothing seems to work for me. 

 

At the moment my deployment pipeline downloads artifacts and is able to use them for deployment, but can not actually deploy the project due to missing SqlPackage.exe file in the expected location.

 

Any help would be greatly appreciated! 

 

EDIT: 
At the moment I'm trying to use mailto:CmdLine@2 task (see below), but it's giving me an error. 

   
 - taskCmdLine@2
      inputs:
        script'"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\sqlpackage.exe" /Action:Publish /SourceFile:"$(System.DefaultWorkingDirectory)/_WIP Build DB Symfonie2_ods/files/s/Symfonie2_ODS/bin/Debug/Symfonie2_ODS.dacpac" /TargetServerName:$(TargetServer) /TargetDatabaseName:$(TargetDatabaseName) -U $(SqlUsername) -P $(SqlPassword)/TargetEncryptConnection:False'
 

 

1 Reply

  • Any chance on this and return result:

     

    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: '"C:\CustomPath\SqlPackage.exe" /Action:Publish /SourceFile:"$(Build.ArtifactStagingDirectory)/YourProject.dacpac" /TargetServerName:$(TargetServer) /TargetDatabaseName:$(TargetDatabaseName) -U $(SqlUsername) -P $(SqlPassword) /TargetEncryptConnection:False'

     

Resources