Azure devops Azure中多服务器管理SQL代理作业的替代方法?

Azure devops Azure中多服务器管理SQL代理作业的替代方法?,azure-devops,azure-sql-database,azure-storage,Azure Devops,Azure Sql Database,Azure Storage,目前在我的组织中,共有15个QA和5个UAT SQL环境。到目前为止,我们正在目标服务器之一中使用SQL server的多服务器管理功能管理所有SQL代理作业。现在我们计划在Azure上迁移所有这些SQL数据库环境。在azure中,我们使用的是SQL数据库服务,而不是任何VM框。 所以,是否有任何功能或替代解决方案可以在azure的一个中心位置管理所有环境的所有作业。所有SQL作业都是T-SQL类型的作业 您可以使用将所有Azure SQL数据库作业集中在一个位置 您可以在Azure Autom

目前在我的组织中,共有15个QA和5个UAT SQL环境。到目前为止,我们正在目标服务器之一中使用SQL server的多服务器管理功能管理所有SQL代理作业。现在我们计划在Azure上迁移所有这些SQL数据库环境。在azure中,我们使用的是SQL数据库服务,而不是任何VM框。 所以,是否有任何功能或替代解决方案可以在azure的一个中心位置管理所有环境的所有作业。所有SQL作业都是T-SQL类型的作业

您可以使用将所有Azure SQL数据库作业集中在一个位置

您可以在Azure Automation上使用以下命令来计划任何Azure SQL数据库上任何存储过程的执行,无论它们位于哪个Azure SQL逻辑服务器上

workflow SQL_Agent_SprocJob
{
[cmdletbinding()]
param
(
# Fully-qualified name of the Azure DB server
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $SqlServerName,
# Name of database to connect and execute against
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $DBName,
# Name of stored procedure to be executed
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $StoredProcName,
# Credentials for $SqlServerName stored as an Azure Automation credential asset
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[PSCredential] $Credential
)
inlinescript
{
Write-Output “JOB STARTING”
# Setup variables
$ServerName = $Using:SqlServerName
$UserId = $Using:Credential.UserName
$Password = ($Using:Credential).GetNetworkCredential().Password
$DB = $Using:DBName
$SP = $Using:StoredProcName
# Create & Open connection to Database
$DatabaseConnection = New-Object System.Data.SqlClient.SqlConnection
$DatabaseConnection.ConnectionString = “Data Source = $ServerName; Initial Catalog = $DB; User ID = $UserId; Password = $Password;”
$DatabaseConnection.Open();
Write-Output “CONNECTION OPENED”
# Create & Define command and query text
$DatabaseCommand = New-Object System.Data.SqlClient.SqlCommand
$DatabaseCommand.CommandType = [System.Data.CommandType]::StoredProcedure
$DatabaseCommand.Connection = $DatabaseConnection
$DatabaseCommand.CommandText = $SP
Write-Output “EXECUTING QUERY”
# Execute the query
$DatabaseCommand.ExecuteNonQuery()
# Close connection to DB
$DatabaseConnection.Close()
Write-Output “CONNECTION CLOSED”
Write-Output “JOB COMPLETED”
}
}

使用分步教程开始学习。

感谢Morillo的帮助。目前我正在探索Azure的弹性代理作业功能,它提供了相同的功能。同时,我也会检查您的解决方案。之后,我可以为我的解决方案确定合适的、可管理的方法。再次感谢。弹性工作的管理主要是PowerShell。这可能是个问题。我希望你能找到你想要的解决方案。