首页 > 解决方案 > 无法在复制数据工具中连接到 SFTP(带有私钥文件)

问题描述

我正在尝试将数据从 SFTP 复制到 blob,但在创建 SFTP 源时卡住了。

我有连接详细信息,可以在 Filezilla 或 WinSCP 上轻松连接。但是,我无法让它在 Azure 数据工厂中工作。

我没有使用代码,而是使用用户界面。

创建 SFTP 源的页面上的连接详细信息:通过集成运行时连接:AutoResolveIntegrationRuntime(默认)

Host: xyz

Port: 22 (can't remove it as it doesn't like it)

SSH Host Key Validation: Enable SSH Host Key Validation

SSH Host Key Finger-print: taken from WinSCP - Session - Server/protocol information

Authentication type: SSH Public Key Authentication   -can't use basic as the private key holds the security info

User name:XXX

Private Key Type: Use Key Content

Private key content: loaded the .ppk file, tried also tried loading the .pem file and got different errors

Pass Phrase: none

在 WinSCP 或 FileZilla 中设置此 sftp 时,它会自动将提供的 .pem 文件转换为 .ppk。当我将 .ppk 文件加载到 ADF 中时,出现错误:为“SshPublicKey”身份验证类型提供的 Sftp 凭据无效。当我加载 .pem 文件时,我得到:连接到 Sftp 服务器“spiderftp.firstgroup.com”时遇到网络问题,SocketErrorCode:“TimedOut”。

我还在 SSH 主机密钥验证中尝试了“禁用 SSH 主机密钥验证”,但没有任何区别。

我还在 PuttyGen 中打开了 .ppk 文件并使用了该主机密钥指纹,但仍然没有运气。

根据我加载的文件,只会收到这 2 个错误。

在网上找不到任何关于此的信息,因此不胜感激。

标签: azure-data-factory-2

解决方案


你读过这个文档中的这个注释吗?

https://docs.microsoft.com/en-us/azure/data-factory/connector-sftp#using-ssh-public-key-authentication

SFTP 连接器支持 RSA/DSA OpenSSH 密钥。确保您的密钥文件内容以“-----BEGIN [RSA/DSA] PRIVATE KEY-----”开头。如果私钥文件是 ppk 格式的文件,请使用 Putty 工具将 .ppk 格式转换为 OpenSSH 格式。


推荐阅读