1
votes

I have the following YAML configured but guessing I cannot use a storage account for a source input here? I assumed I could since the task simply uses azcopy (note: the command works fine from command line just not in the pipeline (i.e. permissions are set (e.g. SPN has been authorized and RBAC set).

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

1
So, this one is a head-scratcher, to be sure - I've looked at the Powershell for the AzureFileCopy@4 task, and it seems to pass it directly to a utility function that uses it with the azcopy command. AzCopy, in turn, is supposed to support container to container copies, so you don't seem to be doing anything wrong from that perspective. The only thing I can't really see, because I can't verify the underlying source easily, is if the Get-VSTSInput on that parameter is "sanitizing" it somehow???WaitingForGuacamole
Where did/do you find the PS code for that AzureFileCopy@4 task?Karl Binger
github.com/microsoft/azure-pipelines-tasks. It's been quite useful to see what happens behind the scenes.WaitingForGuacamole
Hi there, is there any updates for this question? Does Kevin's answer can help you? Please feel free to comment~ Just a remind of this.Jane Ma-MSFT

1 Answers

0
votes

Azure File Copy task only supports to upload the files from local machine or UNC share to storage account.

You could check the sourcepath field definition in task introuduction.

enter image description here

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.

- 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