[英]Using Azure File Copy Task in Azure DevOps to Copy Data from Storage Account to Storage Account
I have the following YAML configured but guessing I cannot use a storage account for a source input here?我配置了以下 YAML 但猜测我不能在这里使用存储帐户作为源输入? I assumed I could since the task simply uses azcopy (note: the command works fine from command line just not in the pipeline (ie permissions are set (eg SPN has been authorized and RBAC set).我假设我可以,因为该任务只是使用 azcopy (注意:该命令在命令行中运行良好,只是不在管道中(即设置了权限(例如,已授权 SPN 并设置了 RBAC)。
Here's the code:这是代码:
trigger:
- dev
pool:
vmImage: windows-latest
steps:
#Copy files to Azure Blob Storage
- task: AzureFileCopy@4
inputs:
sourcePath: 'https://someonesbackups.blob.core.windows.net/backups?mysastokengoeshere'
azureSubscription: MY-Production-Subscription
destination: azureBlob
storage: azcopypipelinetest
containerName: restored
additionalArgumentsForBlobCopy: --recursive=true
However, when that runs I get the following error:但是,当它运行时,我收到以下错误:
"failed to perform copy command due to error: cannot start job due to error: cannot scan the path \\?\D:\a\1\s\https:\someonesbackups.blob.core.windows.net\backups?mysastokengoeshere=-REDACTED-, please verify that it is a valid."
Certainly seems as though you could do this but guessing I'm missing something fundamental here.当然看起来好像你可以做到这一点,但我猜我在这里遗漏了一些基本的东西。
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-file-copy?view=azure-devops https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-file-copy?view=azure-devops
Azure File Copy task only supports to upload the files from local machine or UNC share to storage account. Azure 文件复制任务仅支持将文件从本地计算机或 UNC 共享上传到存储帐户。
You could check the sourcepath field definition in task introuduction.您可以在任务介绍中检查sourcepath 字段定义。
To Copy Data from Storage Account to Storage Account, you need to use azcopy command to copy to the file to local machine and use Azure File Copy task to upload the file to another storage account.要将数据从存储帐户复制到存储帐户,您需要使用azcopy 命令将文件复制到本地计算机,并使用 Azure 文件复制任务将文件上传到另一个存储帐户。
- script: 'azcopy copy ''https://mystorageaccount.blob.core.windows.net/mycontainer/myBlobDirectory/*'' ''$(build.sourcesdirectory)\myDirectory'''
displayName: 'Command Line Script'
- task: AzureFileCopy@4
inputs:
sourcePath: '$(build.sourcesdirectory)\myDirectory'
azureSubscription: MY-Production-Subscription
destination: azureBlob
storage: azcopypipelinetest
containerName: restored
additionalArgumentsForBlobCopy: --recursive=true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.