Search code examples
powershellazureazure-files

Is any way can download file from Azure File(not blob) share by powershell


I want download a large file from the Azure File storage by powershell,
I found all the solution are use the Azure blobs, it's can not work with Azure files,

Is any way to download the file from Azure files?

[Note:because the file is very big(127GB) and will cost much time to download it(may need 3~4days), so it always broken when I using the browser to download it]

below is the official document: https://learn.microsoft.com/en-us/azure/storage/storage-powershell-guide-full


Solution

  • You could use the following cmdlets to download a file from Azure File Share.

    $ctx = New-AzureStorageContext [storageaccountname] [storageaccountkey]
    ##sharename is your existed name.
    $s = Get-AzureStorageShare [sharename] –Context $ctx
    ##To download a file from the share to the local computer, use Get-AzureStorageFileContent.
    Get-AzureStorageFileContent –Share $s –Path [path to file on the share] [path on local computer]
    

    If you want to download multiple files using one command, you could use Azcopy.

    AzCopy /Source:https://myaccount.file.core.windows.net/myfileshare/ /Dest:C:\myfolder /SourceKey:key /S
    

    More information please refer to this link.