如何将文件从Azure存储文件共享复制到发布管道代理 [英] How to copy a file from Azure Storage fileshare to Release pipeline agent
问题描述
我想将FileShare中Azure文件存储中的文件下载到发布管道代理中.
I want to download a file that is on my Azure File storage in FileShare into my release pipeline agent.
在发布管道中,我正在使用PowerShell步骤并运行以下命令:
Inside the release pipeline I am using a PowerShell step and run the command:
Start-AzStorageFileCopy -SrcShareName "report.xml" -SrcFilePath "." -DestFilePath "$(System.DefaultWorkingDirectory)" -DestShareName "report.xml" -Context $(context)
它现在要我输入参数-name
its asking me now for a parameter -name
2020-05-09T01:43:34.1007773Z ##[error]Cannot process command because of one or more missing mandatory parameters: Name.
基本上,我的计划是将此文件用于发布管道中的测试报告.因此,我需要在发布测试结果"步骤中使用该文件.
Basically my plan is to use this file for a test report in a release pipeline. Therefore I need this file to be used in a Publish Test Result step.
推荐答案
由于试图从Azure文件共享下载单个report.xml文件,请直接使用Get-AzureStorageFileContent
命令.
Since you are trying to download single report.xml file from Azure File Share, directly use Get-AzureStorageFileContent
command.
示例:
$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.
More detail info please take a look at this blog.
这篇关于如何将文件从Azure存储文件共享复制到发布管道代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!