0

I would like to copy files to blob, but failing. I have blob prefix ''. What is should be and how to add?

ERROR:

## [error]Upload to container: 'arm' in storage account: 'devopsstorageken' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme

YML:

pool:
  vmImage: 'vs2017-win2016'

steps:

- task: AzureFileCopy@4
    inputs:
    SourcePath: '$(Build.Repository.LocalPath)/ARMTemplates'
    azureSubscription: 'TestRG-Conn'
    Destination: 'AzureBlob'
    storage: 'devopsstorageken'
    ContainerName: 'arm'
Vince Bowdren
  • 8,326
  • 3
  • 31
  • 56
Kenny_I
  • 2,001
  • 5
  • 40
  • 94

3 Answers3

1

What about indentation? inputs: should be on the task level.

blobPrefix can be anything you want. For example, the name of the environment or simply blobPrefix: test.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
0

There are two work around:

  1. You can rollback that task to the old versions (v2 worked for me). In the old versions you don't need to do any extra job in Azure Portal.
  2. If you want to keep using the latest version, you need to make sure that the Service Principal used in that task has access to the Storage Account. Try to navigate to the Access control page and Add a role assignment (Storage Blob Data Contributor / owner role) to your Service Principal/Managed Identity.

Reference

Luiz Lelis
  • 468
  • 7
  • 11
0

I want to add some additional info that would have helped me when I had this same issue using AzureFileCopy@5.

The title says 'problem with blob prefix' but that's not related to this issue. There is no blobPrefix specified in OP's yml and the error message just includes the empty quotes for information. If there was a blobPrefix specified as in a previous answer, it would be in those quotes.

The other answer mentions that the Service Principal needs the 'Storage Blob Data Contributor' role assignment, which is correct, but it also needs the 'Storage Queue Data Contributor' role assignment - usually at the storage account level above the specified container.

The real reason for the task failing would be in the request/response summary above the ##[error] message:

INFO: Authentication failed, it is either not correct, or expired, or
does not have the correct permission -> github.com/Azure/azure-storage-blob-go/azblob.newStorageError...
===== RESPONSE ERROR (ServiceCode=AuthorizationPermissionMismatch) =====
Description=This request is not authorized to perform this operation using this permission.
...
RESPONSE Status: 403 This request is not authorized to perform this operation using this permission
....
X-Ms-Error-Code: [AuthorizationPermissionMismatch]
Jon Wood
  • 11
  • 5