当我使用
为 Azure DevOps Server 2022 创建 INI 文件时tfsconfig unattend /create /type:NewServerAdvanced /unattendfile:advanced.ini
创建的 ini 文件中可用于搜索的唯一设置是
ConfigureSearchService=False
其他组件完整记录在生成的 ini 文件中。但搜索没有其他选择。
将选项更改为
True
时,我遇到了错误,这些错误为我提供了所需的其他参数。
ElasticsearchUser
ElasticsearchPassword
但是配置仍然失败
[Error] [Search Configuration] Cannot create the folder for the Search index store. Check
that the installation wizard has the appropriate permissions to access the folder you
specified, or create and specify a new folder for the index store.
MS 在其网站上没有进一步的帮助MS Learn - Azure DevOps - 执行无人值守安装
搜索了一段时间后,我发现了对
https://devblogs.microsoft.com/tfsao
的引用,但该博客区域早已被MS删除了。它甚至没有被 Wayback Machine 存档。
如何使用无人参与文件配置搜索?
好吧,答案似乎是根据控制台和无人值守日志文件中收到的错误消息猜测要使用的参数...
到目前为止我发现了以下附加参数...
ServiceAccountPassword
SmtpFromAddress
SmtpServer
IndexLocation
ElasticsearchUser
ElasticsearchPassword
我实际上在 MS 开发者社区的一个问题中发现了
IndexLocation
...使用 PowerShell 时,一个干净、安静且无人值守的设置可能看起来像这样......
在 SQL Server 设置后准备数据库:
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString =
"Server=DBSrv," +
"1433;" +
"Database=master;" +
"Trusted_Connection=True;"
$Command = New-Object System.Data.SqlClient.SqlCommand
$Command.CommandType = 1
$Command.Connection = $SqlConnection
$SqlConnection.Open()
$Command.CommandText = "create login [domain\azdos_service] from windows with " +
"default_database=[master], default_language=[us_english]"
$Command.ExecuteNonQuery()
$Command.CommandText = "create login [domain\azdos_setupaccount] from windows with " +
"default_database=[master], default_language=[us_english]"
$Command.ExecuteNonQuery()
$Command.CommandText = "exec master..sp_addsrvrolemember " +
"@loginame = N'domain\azdos_service', @rolename = N'sysadmin'"
$Command.ExecuteNonQuery()
$Command.CommandText = "exec master..sp_addsrvrolemember " +
"@loginame = N'domain\azdos_setupaccount', @rolename = N'sysadmin'"
$Command.ExecuteNonQuery()
在 DevOps 服务器上(当然是在下载媒体之后):
Start-Process d:\AzureDevOps2022.0.1.exe -Args '/Silent' -Wait
Start-Process msiexec -ArgumentList "/i C:\Users\public\downloads\zulu8.72.0.17-ca-jre8.0.382-win_x64.msi ADDLOCAL=FeatureJavaHome /qn" -Wait
cd 'C:\Program Files\Azure DevOps Server 2022\Tools\'
.\TfsConfig.exe unattend /create /type:NewServerAdvanced /unattendfile:advanced.ini
$inputs = @(
"SendFeedback=False"
"SqlInstance=DBSrv,1433"
"IsServiceAccountBuiltIn=False"
"ServiceAccountName=domain\azdos_service"
"ServiceAccountPassword=Password!"
"SiteBindings=https:*:443:devops:My:generate"
"PublicUrl=https://devops/"
"FileCacheFolder=C:\AzureDevOpsData\ApplicationTier\_fileCache"
"SmtpEmailEnabled=True"
"[email protected]"
"SmtpServer=mysmtpgateway"
"EnableSshService=False"
"ConfigureSearch=True"
"IndexLocation=C:\AzureDevOpsData\Search\IndexStore"
"ElasticsearchUser=Search1234"
"ElasticsearchPassword=search1234!"
"CollectionName=DevOps"
)
($inputs | where {$_ -like '*password*'}) | Out-File -Append .\advanced.ini -Encoding utf8
$inputs = ($inputs | where {$_ -notlike '*password*'}) -join ';'
.\TfsConfig.exe unattend /configure /unattendfile:advanced.ini /continue /inputs:$inputs
请忽略此示例中对密码的不良处理。