AzureFileCopy@6 管道任务失败

问题描述 投票:0回答:1

AzureFileCopy@6
管道任务失败并出现以下错误:

"Exception calling ".ctor" with "2" argument(s): "Method not found: 'Newtonsoft.Json.JsonSerializerSettings System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.get_SerializerSettings()'." 

我们正在利用

Service connection type - Azure Resource Manager
,使用 工作负载身份联合和 openid connect。

azure powershell pipeline azure-file-copy
1个回答
0
投票

根据我的SO回答似乎还不支持Workload Identity。相反,你可以利用具有服务主体身份验证的 Azure 资源管理器连接或常规服务连接。将适当的角色(例如 Azure 存储 Blob 数据贡献者或 Azure 存储 Blob 数据所有者)分配给存储帐户上的服务连接。或者,您可以直接在 AzCopy URL 中使用具有受限角色的 SAS 令牌。

存储帐户级别将 
Storage Blob Data Owner 角色分配给在 Azure Devops 中添加为服务连接的 Azure 服务主体:-

enter image description here

Azure Devops Service connection:-

enter image description here

Azure DevOps yaml 代码:-

trigger:
  branches:
    include:
      - main

pool:
  vmImage: 'windows-latest'

steps:
- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '6.x'
    installationPath: $(Agent.ToolsDirectory)/dotnet

- task: AzureFileCopy@4
  inputs:
    SourcePath: '$(System.DefaultWorkingDirectory)/SampleApp48'
    azureSubscription: 'PowershellSid'
    Destination: 'AzureBlob'
    storage: 'siliconstrg532'
    ContainerName: 'data'

输出:-

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.