Home > Blockchain >  Azure Devops PowerShell Script Not Writing DACPAC Output
Azure Devops PowerShell Script Not Writing DACPAC Output

Time:10-18

I'm attempting to execute a PowerShell script in Azure DevOps that creates a DACPAC file. The script completes successfully but no file shows up where it's supposed to show up. The script works properly when I run it via the PowerShell client.

Here's the script log

The script is run inline. Here's the script:

& $(SqlPackagePath) /TargetFile:$(TargetDacPacFile1) /Action:Extract /SourceServerName:$(SqlServerName1) /SourceDatabaseName:$(DbName1) /SourceUser:$(SourceUser) /SourcePassword:$(SourcePassword)

enter image description here

CodePudding user response:

I resolved the issue. Apparently, Azure Pipelines doesn't have access to the file system AFAIK. I changed the target path from the local file system to $(agent.releaseDirectory)/$(TargetDacPacFile1). I was then able to pick up the DACPAC file in the next activity to deploy it.

If anyone knows how one can view the $(agent.releaseDirectory) directory, I'd appreciate a tip. Thx.

CodePudding user response:

note: not an answer

If anyone knows how one can view the $(agent.releaseDirectory) directory, I'd appreciate a tip

A lot of effort in Azure DevOps is running commands like this to work out where the hell your file is:

  - task: CmdLine@2
    displayName: Check Build.SourcesDirectory Path
    inputs:
      script: DIR $(Build.SourcesDirectory) /B /S
  • Related