1

I have some .sql scripts in a sql server. I want to deploy them to another server using Azure devops. Sorry, I maybe asking a silly question but i am actually new to Azure devops. Thanks in advance.

Samyak Jain
  • 155
  • 1
  • 2
  • 8
  • Please, describe your infrastructure and what you have already tried. What Azure Pipeline agents you are using (hosted, self-hosted)? What is connection to you SQL Server, is it public server or in private network ? Do you have any pipelines in Azure DevOps already? – Ivan Ignatiev Feb 20 '20 at 09:35
  • The requirement is little confusing, what do you mean by "deploy them to another server"? Are you trying to run your .sql script against another database like the subject mentioned or run against another server/machine? If it's the second situation, then i suggest you could use the Copy Files task to copy your .sql file to the target machine, then use the PowerShell task to execute it with the [Invoke-Sqlcmd](https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-sqlcmd?view=sqlserver-ps). – Yang Shen - MSFT Feb 20 '20 at 09:43
  • @IvanIgnatiev so ihave a azure sql server where i have my databases and stored procs related to my pipelines in the azure data factory. These stored procs are used while computation when my pipelines run in ADF. So as part of CI/CD, i have deployed the ADF in another environment say, QA. but for my pipelines to run successfully, i need these databases and stored procs also which are currently not there. I want to have those here in QA environment. It is private network. I am thinking of Azure SQL DB deployment task but it deploys the whole database. – Samyak Jain Feb 20 '20 at 09:52
  • @YangShen-MSFT I have commented my scenario above, kindly have a look at it. Thanks – Samyak Jain Feb 20 '20 at 09:53
  • @SamyakJain Azure Documentation suggest to use Sqlcmd, https://learn.microsoft.com/en-us/azure/devops/pipelines/targets/azure-sqldb?view=azure-devops&tabs=yaml#sql-scripts , you need just to insure that the tool is present on your pipeline agent (if you are using agent with Visual Studio it should be there already). – Ivan Ignatiev Feb 20 '20 at 10:19

0 Answers0