具有Azure DevOps管道的AzureFileCopy失败-'AzCopy.exe以非零退出退出 [英] AzureFileCopy with Azure DevOps pipeline fails - 'AzCopy.exe exited with non-zero exit

查看:137
本文介绍了具有Azure DevOps管道的AzureFileCopy失败-'AzCopy.exe以非零退出退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将ARM模板复制到存储中,但是失败了. YML有什么问题?

I try to copy ARM templates to storage but failing. What could wrong with YML?

错误:

& "AzCopy\AzCopy.exe" logout
INFO: Logout succeeded.
INFO: AzCopy.exe: A newer version 10.4.3 is available to download

Disconnect-AzAccount -Scope Process -ErrorAction Stop
Clear-AzContext -Scope Process -ErrorAction Stop
##[error]Upload to container: 'arm' in storage account: 'devopsstorageken' with blob prefix: 'test' 
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
Finishing: AzureFileCopy

YML:

- task: AzureFileCopy@4
  inputs:
    SourcePath: '$(Build.Repository.LocalPath)/ARMTemplates/CreateSQLServerARM'
    azureSubscription: 'TestRG-Conn'
    Destination: 'AzureBlob'
    storage: 'devopsstorageken'
    blobPrefix: 'test'
    ContainerName: 'arm'

推荐答案

我尝试将ARM模板复制到存储中,但是失败了.有什么问题 与YML?

I try to copy ARM templates to storage but failing. What could wrong with YML?

您的yml看起来正确.我想任务本身可能有问题.

Your yml looks right. I guess there might be something wrong with the task itself.

作为一种解决方法,我们可以使用AzureFileCopy@3,在此版本中,我们不需要在Azure Web Portal中做任何额外的工作.

As a workaround we can use the AzureFileCopy@3, in this version we don't need to do any extra job in Azure Web Portal.

在预览AzureFileCopy@4中,有一些区别.我们需要确保在此任务中使用的Service Principal具有访问存储帐户的权限.对我来说,我需要导航到Access control页,并导航到Add a role assignment(存储Blob数据贡献者/所有者角色)到我的服务主体/受管理身份:

And in preview AzureFileCopy@4, there's some difference. We need to make sure the Service Principal we use in this task have access to the Storage Account. For me, I need to navigate to Access control page and Add a role assignment(Storage Blob Data Contributor/owner role) to my Service Principal/Managed Identity:

这样AzureFileCopy版本4也可以在我这边工作.

So that the AzureFileCopy version4 could also work on my side.

这篇关于具有Azure DevOps管道的AzureFileCopy失败-'AzCopy.exe以非零退出退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆