Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Machine File Copy - DevOps task and IP address

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.

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

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

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

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

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

Then, I got this error:

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.

What's the issue here?

like image 911
mnj Avatar asked Jun 05 '19 11:06

mnj


People also ask

How do I copy an azure Devops task?

From the web portal, open a backlog or query results page, and multi-select the work items you want to copy to the clipboard. Open the … context menu of one of the selected work items, and then choose Copy to clipboard or Copy as HTML. Here we multi-select from the product backlog and choose Copy to clipboard.

What is SSH endpoint?

SSH endpointThe name of an SSH service connection containing connection details for the remote machine. The hostname or IP address of the remote machine, the port number, and the user name are required to create an SSH service connection. - The private key and the passphrase must be specified for authentication.


1 Answers

I was getting the exact same error while doing these:

  • Initially in my release pipeline, I had an agent job and I created a Windows machine file copy task under the job and filled in all details correctly. I set the Machines field with the public IP address of my target server (a Windows azure VM) and I always got this error you reported.

  • I tried to use the Azure file copy task instead but I was faced with another problem (error message: Unable to get FQDN for all resources in ResourceGroup: {resourceGroupName}) which I couldn't get to fix after a lot of efforts.

This is the solution that worked for me:

  • Instead of running an agent job, I ran a Deployment Group Job. With deployment groups, I didn't need an IP address to connect to my VM. Setting up a deployment group for your Azure VM is very simple and well explained here

  • I created a Windows Machine File Copy task under the Deployment Group job I added. I filled same details for the task except that instead of the IP address of the Windows VM, I entered the computer name in the Machines field and the file copy task ran successfully!

I hope this helps

like image 199
Yusuff Sodiq Avatar answered Nov 15 '22 02:11

Yusuff Sodiq