程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了通过 Azure Devops CICD 管道执行简单的 SQL 查询大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决通过 Azure Devops CICD 管道执行简单的 SQL 查询?

开发过程中遇到通过 Azure Devops CICD 管道执行简单的 SQL 查询的问题如何解决?下面主要结合日常开发的经验,给出你关于通过 Azure Devops CICD 管道执行简单的 SQL 查询的解决方法建议,希望对你解决通过 Azure Devops CICD 管道执行简单的 SQL 查询有所启发或帮助;

我是 Azure Devops 和 CICD 管道的新手。我的任务是创建 CICD 管道以从 Azure Devops CI/CD 管道执行 sql 查询。我怎么做?任何建议都会有所帮助。

解决方法

SQL 查询可以通过 ADO tasks

运行

类似于:

variables:
  AzureSubscription: '<Azure service connection>'
  ServerName: '<Database server name>'
  Databasename: '<Database name>'
  AdminUser: '<SQL user name>'
  Adminpassword: '<SQL user password>'
  SQLFile: '<LOCATIOn of SQL file in $(Build.sourcesDirectory)>'

steps:
- task: AzurePowerSHell@2
  displayName: Azure PowerSHell script: FilePath
  inputs:
    azureSubscription: '$(AzureSubscription)'
    ScriptPath: '$(Build.sourcesDirectory)\scripts\SetAzureFirewallRule.ps1'
    ScriptArguments: '$(ServerName)'
    azurePowerSHellVersion: LatestVersion

- task: CmdLine@1
  displayName: Run Sqlcmd
  inputs:
    filename: Sqlcmd
    arguments: '-S $(ServerName) -U $(AdminUser) -P $(Adminpassword) -d $(DatabaseName) -i $(SQLFilE)'

- task: AzurePowerSHell@2
  displayName: Azure PowerSHell script: FilePath
  inputs:
    azureSubscription: '$(AzureSubscription)'
    ScriptPath: '$(Build.sourcesDirectory)\scripts\RemoveAzureFirewallRule.ps1'
    ScriptArguments: '$(ServerName)'
    azurePowerSHellVersion: LatestVersion

请注意,如果您使用防火墙规则,则额外的步骤是移除防火墙

大佬总结

以上是大佬教程为你收集整理的通过 Azure Devops CICD 管道执行简单的 SQL 查询全部内容,希望文章能够帮你解决通过 Azure Devops CICD 管道执行简单的 SQL 查询所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。