Search code examples
azureazure-powershellazure-virtual-machine

how to download the files present in cloud drive of azure portal?


I have created 2 instances of Azure Linux VMs using Azure PowerShell and their Public, Private Key files are saved in the cloud drive.

Path:

Private key is saved to /home/user/.ssh/1694408615
Public key is saved to /home/user/.ssh/1694408615.pub

enter image description here

How to download these files from the cloud drive?

So that I can make use of those key while connecting to Linux VMs.

Update: I come to know the command i.e., download filename - Its worked.

Now the question is - "How to download multiple files or all the files present in Azure CloudShell drive?"


Solution

  • Now the question is - "How to download multiple files or all the files present in Azure CloudShell drive?"

    To copy all files from Azure Cloud Shell to a local path, follow the steps below.

    1. First, copy all files to clouddrive using the command below.
    cp -r  /home/user/SSH   /home/user/clouddrive/
    

    In your case command is below.

       cp -r  /home/user/.ssh   /home/user/clouddrive/
    
    1. Once you've copied the files to clouddrive, verify the files by navigating to clouddrive
        cd clouddrive
        ls
    

    Output: enter image description here

    1. Download the files from Azure File share to local using Azcopy command.

      Generate SAS Token inside Storage account.

    enter image description here

     azcopy cp   "https://csg10032002cghg3ea4.file.core.windows.net/?<Your-sastoken>" "<Local-Path\SSH" --recursive=true
    

    enter image description here

    All files are downloaded from Cloud Shell to Local.

    enter image description here

    Reference: Stack Link by Charles Xu