我正在尝试通过Endpoint REST API创建一个Azure DevOps SSH服务连接。我可以成功创建连接,并在Azure Devops中看到它。当在发布管道中使用服务连接来连接到Linux服务器时,任务将失败,并显示以下错误:
无法连接到远程计算机。验证SSH服务连接详细信息。错误:错误:无法解析privateKey:不支持的密钥格式。
我正在使用PowerShell进行REST API调用。如何格式化密钥的数据?
我正在尝试初始化一个变量来存储密钥。
$key ='-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAzXwFoU9j6c6bzXn3QQAyxpEVC7t2gSQKBq7jsQveN/reHb4I
X+Bo5y7Grc59mjr6gXxaoALyt8kOyGkFu5e+KZdx2CwANu77l3gV7bn4MEydoOxD
txBISCBXQ+ydnhkbKWSkLoknyu8+jjkVuJLA2ARFAzL+kPexK+Y91QEFG9O9YcFE
kNQk+LvVEQ0efm1SNaockJQ2SY3l8sAXpY9vHJ1rqgFmj6o3i1YvlBU3UnkIYB8t
o9pYlJI3oM6FkBrCwc77Nronqh79FiwvPpepVdOIPc4/uCF/0Xyte9+hG2iAEiJQ
8TPjYXPTzNdGvhdv/18GT/xzGZ1NYSE/dTmftwIDAQABAoIBAFvqBQ6x12xnObQA
wYO21f+SOArGcOy1NTLmGf1A5Ma/lYlSTqasV+BJQR/PxMkvZoxzFoqKpw1khxNI
PwM5jhtGnernS7VG0w1e7tgmnojkTIIGDQge5WY16TL97Uchzc+HMBWMzlrtB1tQ
15F3O4Gk70XOEqa/1OVhGPllemaGU+/7jisfhrROJ4Q0YK32vGbD+SPfKh8EeqHR
REVwjO8lpb83Aap1d9WZl2ClK5jl8md+SYkEK264Ktthkv4I9c1w25fyBO3dOPck
jYs9oD7lJQr/MH4HUIGiKyvD+AtU9ASoW7EL88siCS+FwHnfcu2H2WAE/0W3uD/w
Jqe1JbECgYEA6bbYyxSIYeX38vBsdya4ivcwzf1oTmvnAsJKKIXmtHcX2M4Ox64i
rVkWygX1V0J3k8uCWM2k7PgiavNmM8CThqMRfNgd+vL8okErXhv2pfUuOdvXO2VG
Kr1oO4exjSK2eNM4MIxYv7SFrfbABC/ftLFjIan4TxqRbAtXAZ5W1PkCgYEA4RQQ
N0SeZIIOazF5Uo20q5m+vd/5JHXtkr/hEz6rqzN1YBjVoQZxCHQY8lnWPR4u0bzJ
L0dsIIK0cUacWsqTxIoPSLnjUAXXSizv8HYcxOqelSATDayssePuMFG3DXRH8uJq
CCO/dT9ImUBsg7awjPyErLvlq2iSoqDcnmg8Ni8CgYEApC5995PyBwv9dh2tpLp/
06e5EkwddVHZ1BdW70a5fjdXekevHFlZJPu7xaoP4v/fbuT9KZM1c/8Qdp+MQXjc
ai2uAEz2Kq9+CCHN7GuqhoVJtv2YIrKPa0Dps0As25/yHckL5RcC1ZFkg4QrC79M
MOyYXjLALBnW5NbGhW2NREkCgYBd6bIubVotk7qSbW0yzd+xrg/RR++7j90V2yv9
jKuyXmE+PH5+lqJ5JX/3NxbWH47ngn7rVEDAe+jwTscUduwbGIPyE2XOUPGYiJGA
4rd0TnTmwiBRF1hjTThoPuBDI96VcHVPeiL7t/EByMi+WG7oFMEDFc9pqtNsOfRz
wAhHjwKBgHsRxR3SuP2pWxjHJ6W0IelKXxvRqaaXMFTxugosLhrXaBWtjRCPVLnq
3FOmp3w2fzfHdETDNMYVNIDrS73DqPCd80zvuEGEfU+pArDpb7sdBOcH2wP+8GQ1
PWZ13fdop21clkI8vpNyu7RHmCQtulWWiQ8t6+B6h86j8pLxxrYn
-----END RSA PRIVATE KEY-----'
数据在服务连接中看起来正确,但是在使用时失败。