Search code examples
azureazure-blob-storageazure-powershellazure-cloud-shell

How to add the files in $Home directory from blob of Azure cloud shell


I am new to powershell. Writting code in azure cloud shell. I want to add files in Azure cloud shell $HOME directory from blob storage. How I can achieve this task?

Really appreciated for help.

To get script to add files into $home directory from azure blob storage in cloud shell

Later Tried azcopy command but getting error as: enter image description here

Code what I tried enter image description here


Solution

  • To get the script to add files into the $home directory from Azure blob storage in the cloud shell

    To get the files from Azure blob storage to the $home directory, you can use the Azcopy tool.

    In my environment, Azure blob storage has five files as like below:

    enter image description here

    Command:

    You can use the below command to get the multiple files to your home directory.

     azcopy cp "https://venkat123.blob.core.windows.net/test1/?<Your-sastoken>" "home/" --recursive=true
    

    Output:

    INFO: Scanning...
    INFO: Any empty folders will not be processed, because the source and/or destination doesn't have full folder support
    INFO: azcopy: A newer version 10.19.0 is available to download
    
    
    Job 3cd8663a-58a1-xx has started
    Log file is located at: /home/venkatesan/.azcopy/3cd8663a-xxx.log
    
    0.0 %, 0 Done, 0 Failed, 5 Pending, 0 Skipped, 5 Total, 
    
    
    Job 3cd8663a-58axxx5931561 summary
    Elapsed Time (Minutes): 0.0334
    Number of File Transfers: 5
    Number of Folder Property Transfers: 0
    Total Number of Transfers: 5
    Number of Transfers Completed: 5
    Number of Transfers Failed: 0
    Number of Transfers Skipped: 0
    TotalBytesTransferred: 115831
    Final Job Status: Completed
    

    enter image description here

    Once you execute the above command, you can see the files in your home directory like below:

    enter image description here

    Reference:

    azcopy copy | Microsoft Learn