Created
May 26, 2020 22:10
-
-
Save drmohundro/8727c9bb70f749a7e31e41740f29f58f to your computer and use it in GitHub Desktop.
Get sqlcmd.exe in Azure Pipelines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = 'Stop'; | |
Invoke-WebRequest 'https://vstsagenttools.blob.core.windows.net/tools/SQLCMD/11.0/SQLCMD.zip' -OutFile sqlcmd.zip | |
try { | |
Add-Type -AssemblyName System.IO.Compression.FileSystem | |
} catch { }; | |
[System.IO.Compression.ZipFile]::ExtractToDirectory('./sqlcmd.zip', './') | |
$env:PATH += ";$(Resolve-Path ./SQLCMD)"; | |
# sqlcmd.exe will now be in your PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
References include:
This is more or less how https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/SqlAzureDacpacDeploymentV1 works.
Just add a PowerShell task and use this as an inline script prior to running
sqlcmd.exe
.Note that it would still be preferable to use the SqlServer PowerShell Module as an alternative.