Windows机器文件复制-DevOps任务和IP地址 [英] Windows Machine File Copy - DevOps task and IP address

查看:135
本文介绍了Windows机器文件复制-DevOps任务和IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Azure DevOps上构建发布管道.我发布的一部分内容是将一堆文件复制到Azure VM.据我了解,目标计算机需要打开PowerShell 5986端口.

I am building a Release Pipeline on Azure DevOps. Part of my release is to copy a bunch of files to the Azure VM. As far as I understand, the target machine needs to have PowerShell 5986 port open.

我有一个开放了端口5986的VM(我通过使用目标计算机上的PowerShell"任务远程调用此VM上的一些命令来验证这一点). 我添加了"Windows Machine File Copy"任务并填充了字段: - 来源 -机器 -管理员登录 - 密码 -目标文件夹

I have a VM with port 5986 open (I verified that by invoking remotely some commands on this VM with "PowerShell on Target Machines" task). I added "Windows Machine File Copy" task and filled fields: - Source - Machines - Admin Login - Password - Destination Folder

在机器"字段中,输入目标机器的IP.

In "Machines" field, I put IP of the target machine.

由于运行该发行版,导致出现错误:

As a result of running the release, I'm getting an error:

无法创建带有目的地的PSDrive: '\\ 11.11.11.11 \ C $ \ TargetDirectory', 错误消息:找不到网络路径"网络路径为 找不到

Failed to Create PSDrive with Destination: '\\11.11.11.11\C$\TargetDirectory', ErrorMessage: 'The network path was not found' The network path was not found

我还尝试将IP地址和端口以这种形式放置:11.11.11.11:5986

I also tried to put IP address with a port, in this form: 11.11.11.11:5986

然后,我得到了这个错误:

Then, I got this error:

无法将值"\ 23.97.151.221:5986"转换为键入"System.Uri". 错误:无效的URI:无法解析主机名."

Cannot convert value "\23.97.151.221:5986" to type "System.Uri". Error: "Invalid URI: The hostname could not be parsed."

文档(

Documentation (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/windows-machine-file-copy?view=azure-devops) says that IP address with a port is allowed.

这是什么问题?

推荐答案

问题是因为您不能使用该任务跨Windows域复制文件!也就是说,如果您在主机A上构建并且要将文件复制到主机B,则A和B必须位于同一 Windows域中,否则将出现类似错误

The problem is because you can't use that task to copy files across Windows Domain boundary! That is to say, if you build on host A and want to copy files to host B, then A and B must be in the same Windows Domain, otherwise you'll get the error like

##[error]Failed to Create PSDrive with Destination: '\\your-server-name-or-ip\some\path', ErrorMessage: 'The network path was not found'

这就是说,如果您使用的是托管代理,则无法将带有该任务的文件复制到您拥有的任何主机上,无论它是否具有公共IP或FQDN,因为它们不在同一Windows域中!

That is to say, if you're using a hosted agent, then you're not able to copy files with that task to any host you have, no matter it has a public IP or not, or a FQDN, because they are not in the same Windows Domain!

您有两种解决方法:

  • 如果目标是Azure VM或Azure存储,请使用Azure文件复制任务
  • 使用私人托管代理,并确保您的目标主机和私人代理位于同一Windows域中

最后但并非最不重要的一点是,该文档应该明确说明!解决这个问题浪费了我很多时间!

Last but not least, the document should really make it clear! It wasted me a lot of time on solving the problem!

这篇关于Windows机器文件复制-DevOps任务和IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆