question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AzureFileCopy@4 does not work, but AzureFileCopy@3 does when copying files to blog storage

See original GitHub issue

Question, Bug, or Feature? Type: Bug

Enter Task Name: AzureFileCopy@4

Environment

Server - Azure Pipelines

Agent - Hosted: Windows 2017

Issue Description

This is my yaml definition:

- task: AzureFileCopy@4
  displayName: 'Copy ARM Templates to Azure Storage'
  inputs:
    SourcePath: ArmTemplateTestProject/ArmTemplateTestProject
    azureSubscription: 'my connection to Azure Portal'
    Destination: AzureBlob
    storage: mydatastorage
    ContainerName: armtemplate

Task logs

Uploading files from source path: ‘d:\a\1\s\ArmTemplateTestProject\ArmTemplateTestProject\azuredeploy.json’ to storage account: ‘mydatastorage’ in container: ‘armtemplate’ with blob prefix: ‘’ & “AzCopy\AzCopy.exe” copy “d:\a\1\s\ArmTemplateTestProject\ArmTemplateTestProject\azuredeploy.json” “https://mydatastorage.blob.core.windows.net/armtemplate” Error: wrong number of arguments, please refer to the help page on usage of this command

Troubleshooting

Version 3 of the task, with the same settings appears to work. I can’t see anything wrong with the arguments, it appears from the logs to be using the same azcopy command

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

14reactions
jdthorpecommented, Sep 3, 2020

Seems weird that (A) AzCopy v10 (and hence AzureFileCopy@4) enforces permissions differently than the underlying blob storage data plane, and (B) that granting permissions via the “this pipeline needs permissions to run” popup when running the Azure Pipeline grants sufficient permissions for AzureFileCopy@3 task but not the AzureFileCopy@4 task.

For those unfortunate enough to be as confused about this as I was, the solution is to:

  • open the Devops pipeline and note the name of the service connection
  • open the project settings at the bottom of the Project page, click “Service Connections”, select the service connection, and then click “Manage Service Principal” and then get the display name (optionally changing it to something unique – as all the service principals for service connections in a project have the same default name which can be confusing for the next step)
  • open the Storage resource (Account or container) in the azure portal, then select “Access Control (IAM)” in the blade on the left, then click “Add a role assignment” add the “Storage Blob Data Contributor” role to the service principal
2reactions
samsmithnzcommented, Jun 26, 2020

Thank you @20shivangi. One last thought: Should any of this be in the v4 task docs? I don’t see anything, but it’s a change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AzureFileCopy@3 - Azure file copy v3 task | Microsoft Learn
The name of the container into which files are copied. If the specified container does not exist in the storage account, it will...
Read more >
Visual Studio Feedback
AzureFileCopy@4 task fails with "AuthorizationPermissionMismatch" error ... Task : Azure file copy Description : Copy files to Azure Blob Storage or virtual ...
Read more >
Azure DevOps: Azure File copy troubleshooting - Codewrecks
Azure File Copy Task is really useful, but sometimes it needs a little bit of love to work.
Read more >
Azure DevOps pipeline: Azure Copy Files step V4 error - can't ...
I am tying to deploy static version of storybook to Azure Cloud Storage blob container using Azure DevOps pipeline. Since the image is...
Read more >
Using Azure File Copy from DevOps yaml pipeline
I learned that it's not enough to authorize Azure Resource Manager access from ... but in the end the only thing that worked...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found