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

2

5

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

Redpencil answered 8/5, 2017 at 5:40 Comment(0)
M
5

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.

Mobilize answered 8/5, 2017 at 6:0 Comment(0)
T
6

You can do it in 3 ways

1. Azure Storage Explorer

Install azure storage explorer in any windows, you can download files from there

enter image description here

2. AZ COPY

Execute the below command in powershell to download your file from azure blob

Execute below command like this in powershell

&'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' /Source:https://<STORAGE-ACCOUNT-NAME>.blob.core.windows.net/test-adf /Dest:'C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\Backup' /SourceKey:<BLOB-KEY> /S /XO

3. Azure File Service

You can connect your blob as an external drive so that you can easily copy your file

Tinnitus answered 8/5, 2017 at 6:3 Comment(0)
M
5

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.

Mobilize answered 8/5, 2017 at 6:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.