How to copy a file from Azure Storage fileshare to Release pipeline agent

谁说胖子不能爱 提交于 2020-05-17 05:56:13

问题


I want to download a file that is on my Azure File storage in FileShare into my release pipeline agent.

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)

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.


回答1:


Since you are trying to download single report.xml file from Azure File Share, directly use Get-AzureStorageFileContent command.

Sample:

$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.




回答2:


You are looking to download the file locally from the release agent job, so i would stick to using this command below:

Get-AzStorageFileContent -Context $Context -ShareName "acishare" -Path "report.xml" -Destination $(System.DefaultWorkingDirectory)


来源:https://stackoverflow.com/questions/61690827/how-to-copy-a-file-from-azure-storage-fileshare-to-release-pipeline-agent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!