CopyFilesOverSSH

Theertha Kumara 0 Reputation points
2024-02-20T11:04:23.5933333+00:00

Hi Im trying to copy files over ssh in azure pipeline for windows agent to windows, but not able to do connection establishment .

Community Center | Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Achraf Ben Alaya 1,311 Reputation points MVP
    2024-02-20T11:25:00.2333333+00:00

    To copy files over SSH in an Azure Pipeline from a Windows agent to a Windows machine, you can use the SSH task in your YAML pipeline. Make sure you have SSH enabled on your target Windows machine and you have the necessary credentials to establish the connection.

    Here's a basic example of how you can set up your pipeline YAML:

    
    trigger:
    

    In this YAML:

    • Replace 'your-ssh-service-connection-name' with the name of your SSH service connection. You can set up an SSH service connection in Azure DevOps Pipelines by going to Project Settings > Service connections > New service connection > SSH.
    • Replace 'path/to/your/source/files' with the path of the files you want to copy.
    • Replace 'path/to/your/target/location' with the destination path on the remote machine.

    Ensure that your SSH service connection has the correct credentials (username and private key or password) and the target Windows machine is configured to accept SSH connections. If you're still having issues with connection establishment, ensure that:

    1. SSH is enabled and properly configured on both the source Windows agent and the target Windows machine.
    2. The firewall on both machines allows SSH traffic.
    3. The credentials (username/password or private key) provided in your SSH service connection are correct.
    4. The SSH service connection is configured to connect to the correct host and port.

    If you continue to experience issues, provide more details about the specific errors you're encountering for further assistance.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.