【问题标题】:Is any way can download file from Azure File(not blob) share by powershell是否可以通过powershell从Azure文件(不是blob)共享中下载文件
【发布时间】:2017-10-06 00:47:15
【问题描述】:
【问题讨论】:
标签:
powershell
azure
azure-files
【解决方案1】:
您可以使用以下 cmdlet 从 Azure 文件共享下载文件。
$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]
如果你想使用一个命令下载多个文件,你可以使用Azcopy。
AzCopy /Source:https://myaccount.file.core.windows.net/myfileshare/ /Dest:C:\myfolder /SourceKey:key /S
更多信息请参考这个link。
【解决方案2】:
你可以通过 3 种方式做到这一点
1. Azure 存储资源管理器
在任意窗口安装azure storage explorer,即可下载文件
2。 AZ复制
在 powershell 中执行以下命令从 azure blob 下载文件
在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 文件服务
您可以将 Blob 连接为外部驱动器,以便轻松复制文件