I am attempting to run a SqlPackage /Action:Publish ...
command in a PowerShell pwsh
task on an Ubuntu agent. I installed the tool using dotnet tool install --global microsoft.sqlpackage
. However, when I attempt to call SqlPackage after this successful install, I am met with the following error:
dotnet tool install --global microsoft.sqlpackageYou can invoke the tool using the following command: sqlpackageTool 'microsoft.sqlpackage' (version '162.2.111') was successfully installed.SqlPackage /Action:Publish [...]SqlPackage: /home/vsts/work/_temp/af18b7cc-867a-478a-a211-4ea3963f2b75.ps1:19Line | 19 | SqlPackage /Action:Publish /SourceFile:"$($dacpac.FullName)" /TargetConnec … | ~~~~~~~~~~ | The term 'SqlPackage' is not recognized as a name of a cmdlet, function, | script file, or executable program. Check the spelling of the name, or | if a path was included, verify that the path is correct and try again.
Why is this failing, even though I installed the tool? Separating the task out into separate install and SqlPackage tasks (effectively restarting PWSH session) did not solve the issue. The same problem happens whether on a cloud (ubuntu-latest
) agent or a self-hosted Linux agent.