如何将文件从 Azure 存储文件共享复制到发布管道代理
How to copy a file from Azure Storage fileshare to Release pipeline agent
我想将 FileShare 中我的 Azure 文件存储上的文件下载到我的发布管道代理中。
在发布管道中,我正在使用 PowerShell 步骤和 运行 命令:
Start-AzStorageFileCopy -SrcShareName "report.xml" -SrcFilePath "." -DestFilePath "$(System.DefaultWorkingDirectory)" -DestShareName "report.xml" -Context $(context)
它现在问我参数 -name
2020-05-09T01:43:34.1007773Z ##[error]Cannot process command because of one or more missing mandatory parameters: Name.
基本上我的计划是将此文件用于发布管道中的测试报告。因此,我需要在发布测试结果步骤中使用此文件。
您希望通过发布代理作业在本地下载文件,因此我会坚持使用以下命令:
Get-AzStorageFileContent -Context $Context -ShareName "acishare" -Path "report.xml" -Destination $(System.DefaultWorkingDirectory)
由于您正尝试从 Azure 文件共享下载单个 report.xml 文件,请直接使用 Get-AzureStorageFileContent
命令。
样本:
$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。
更多详细信息请查看此blog。
我想将 FileShare 中我的 Azure 文件存储上的文件下载到我的发布管道代理中。
在发布管道中,我正在使用 PowerShell 步骤和 运行 命令:
Start-AzStorageFileCopy -SrcShareName "report.xml" -SrcFilePath "." -DestFilePath "$(System.DefaultWorkingDirectory)" -DestShareName "report.xml" -Context $(context)
它现在问我参数 -name
2020-05-09T01:43:34.1007773Z ##[error]Cannot process command because of one or more missing mandatory parameters: Name.
基本上我的计划是将此文件用于发布管道中的测试报告。因此,我需要在发布测试结果步骤中使用此文件。
您希望通过发布代理作业在本地下载文件,因此我会坚持使用以下命令:
Get-AzStorageFileContent -Context $Context -ShareName "acishare" -Path "report.xml" -Destination $(System.DefaultWorkingDirectory)
由于您正尝试从 Azure 文件共享下载单个 report.xml 文件,请直接使用 Get-AzureStorageFileContent
命令。
样本:
$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。
更多详细信息请查看此blog。