带有 Azure DevOps 管道的 AzureFileCopy 失败 - 'AzCopy.exe 以非零退出退出 [英] AzureFileCopy with Azure DevOps pipeline fails - 'AzCopy.exe exited with non-zero exit
问题描述
我尝试将 ARM 模板复制到存储,但失败了.YML 有什么问题?
I try to copy ARM templates to storage but failing. What could wrong with YML?
错误:
& "AzCopyAzCopy.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 门户中做任何额外的工作.
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 version4 也可以在我这边工作.
So that the AzureFileCopy version4 could also work on my side.
这篇关于带有 Azure DevOps 管道的 AzureFileCopy 失败 - 'AzCopy.exe 以非零退出退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!