azure-pipelines-tasks: Inline SQL Script doesn't work on 2017 Hosted Agent

We’re using the Azure SQL Database Deployment task’s “Inline SQL Script” in a few build definitions.

https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/SqlAzureDacpacDeployment/README.md

This worked on the “Hosted” queue, but fails on the “Hosted 2017” queue:

==============================================================================
Task         : Azure SQL Database Deployment
Description  : Deploy Azure SQL DB using DACPAC or run scripts using SQLCMD
Version      : 1.1.23
Author       : Microsoft Corporation
Help         : [More Information](https://aka.ms/sqlazuredeployreadme)
==============================================================================
tempFile= d:\a\_temp\tmp6EE1.tmp
Invoke-Sqlcmd -ServerInstance (snip) -Inputfile "d:\a\_temp\tmp6EE1.tmp" -QueryTimeout 600 -ConnectionTimeout 120
SQL Powershell Module is not installed on your agent machine. Please follow steps given below to execute this task
1. Install PowershellTools & SharedManagementObjects(dependency), from https://www.microsoft.com/en-us/download/details.aspx?id=52676 (2016)
2. Restart agent machine after installing tools to register Module path updates
3. Run Import-Module SQLPS on your agent Powershell prompt. (This step is not required on Powershell 3.0 enabled machines)
The term 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
******************************************************************************

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 19 (8 by maintainers)

Most upvoted comments

The required SQL powershell modules have been installed in Hosted VS2017 agents.