简体   繁体   中英

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

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.

在此处输入图像描述

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)

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM