scp similar command in az cli to copy files from remote server to local or vice versa

Ranit Chatterjee 0 Reputation points
2024-09-26T06:35:40.9766667+00:00

Azure CLI has give AD based to ssh into the machine, but when it comes to copy files and/or folders to or from remote server I don't find any command to do it. Is there any way apart from standard scp command to copy files across remote and local machine?

PS: pls introduce az ssh vm scp command or something like that in azure cli!

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,014 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anusree Nashetty 4,380 Reputation points Microsoft External Staff Moderator
    2024-09-26T18:04:59.0666667+00:00

    Hi Ranit Chatterjee,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    Azure CLI does not have a built-in command specifically designed for copying files directly between a local machine and a remote Azure Virtual Machine (VM) in the same way that scp (Secure Copy Protocol) works.

    You can try this as when you connect to a Windows VM using Remote Desktop Protocol (RDP), you can enable the sharing of local drives. This allows you to access files from your local machine directly in the VM.

    For Linux VMs, you can use scp to securely copy files to and from your local machine. The scp command works similarly to ssh but is specifically designed for file transfer. https://learn.microsoft.com/en-us/azure/virtual-machines/copy-files-to-vm-using-scp

    You can use the azcopy command to copy files between a local machine and a remote Azure VM. azcopy is a command-line utility that allows you to copy files to and from Azure Blob, File, and Data Lake Storage. https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10?tabs=dnf#installing-azcopy, https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-files

    You can upload files to Azure Blob Storage from your local machine and then download them to your VM. This is useful for larger files or when working with many files.

    If you have any further queries, please do let us know.


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.