ARM部署Data Factory自托管集成运行时HKLM注册表路径缺失报错
报错原因
你当前使用的注册脚本仅包含集成运行时的注册逻辑,缺少先安装自托管集成运行时软件的前置步骤。报错中提示找不到的注册表路径,是集成运行时安装完成后才会自动写入系统的,虚拟机未安装对应软件自然无法读取到该路径,脚本执行失败退出。
解决方法
- 调整现有注册脚本,在调用
Register-Gateway函数之前,新增集成运行时安装包的下载和静默安装逻辑,参考新增代码如下:
# 替换为你实际存放集成运行时MSI安装包的可访问地址 $installerUrl = "替换为你的集成运行时安装包地址" $installerPath = "$env:TEMP\IntegrationRuntime.msi" Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -UseBasicParsing # 静默安装集成运行时 Run-Process "msiexec.exe" "/i $installerPath /qn /norestart" # 等待安装完成写入注册表,避免后续读取注册表时报错 Start-Sleep -Seconds 30
- 若你的虚拟机为32位Windows操作系统,需修改
Get-InstalledFilePath函数,增加32位注册表路径的检测逻辑,避免安装完成后仍无法读取注册表的问题:
function Get-InstalledFilePath() { # 优先读取64位系统注册表路径 $filePath = Get-RegistryProperty "hklm:\Software\Microsoft\DataTransfer\DataManagementGateway\ConfigurationManager" "DiacmdPath" # 64位路径读取为空时,尝试读取32位系统重定向后的注册表路径 if ([string]::IsNullOrEmpty($filePath)) { $filePath = Get-RegistryProperty "hklm:\Software\Wow6432Node\Microsoft\DataTransfer\DataManagementGateway\ConfigurationManager" "DiacmdPath" } if ([string]::IsNullOrEmpty($filePath)) { Throw-Error "Get-InstalledFilePath: Cannot find installed File Path" } Trace-Log "Gateway installation file: $filePath" return $filePath }
- 将修改完成的脚本重新上传到你ARM模板中
scriptURL参数指定的地址,重新触发ARM部署即可。
内容的提问来源于stack exchange,提问作者achahbar
相关产品推荐
相关产品推荐

