用户没有权限完成此操作。您需要具有“ AddPackage”

我得到一个错误:

User XXX lacks permission to complete this action. You need to have 'AddPackage'

当尝试将nuget包推送到Azure DevOps工件时。我是管理员 这是阶段:

  - stage:
    displayName: 'Release'
    condition: succeeded()
    jobs:
      - job: 'Publish'
        displayName: 'Publish nuGet Package'
        steps:
          - download: current
            artifact: $(PIpelINE_ARTIFact_NAME)
            displayName: 'Download pipeline artifact'
          - script: ls $(PATH_PIpelINE_ARTIFact_NAME)
            displayName: 'Display contents of downloaded articacts path'
          - task: NuGetauthenticate@0
            displayName: 'Authenticate in NuGet feed'
          - script: dotnet nuget push $(PATH_PIpelINE_ARTIFact_NAME)/**/*.nupkg --source $(NUGET_FEED) --api-key $(NUGET_API_KEY)
            displayName: 'Uploads nuGet packages'

确切的错误:

error: Response status code does not indicate success: 403 (Forbidden - User '4a2eb786-540d-4690-a12b-013aec2c86e5' lacks permission to complete this action. You need to have 'AddPackage'. (DevOps activity ID: XXXXXXX-6DF9-4A98-8A4E-42C556C6FC56)).
##[error]Bash exited with code '1'.
Finishing: Uploads nuGet packages

git repo在GitHub中。不知道谁被认为是用户,但我不知道要修改哪些其他权限

karen8848 回答:用户没有权限完成此操作。您需要具有“ AddPackage”

对于像我这样完全迷路的人,diegosasw所说的页面在Artifacts菜单中,而不是在Task或Pipeline中:

enter image description here

,

步骤:

  1. 点击左侧的“Artifacts”。
  2. 从下拉列表中选择您的提要(通常默认选择)
  3. 点击右上角的“Feed Setting”齿轮。
  4. 点击“权限”
  5. 点击“添加用户/群组”并搜索 {your org} Build Service 并添加为贡献者。

enter image description here

,

很棒的发现!在...菜单中允许进行项目范围的构建对我来说很有效。

但是,为了能够将包从Azure Pipelines完全推送到Azure Artifacts提要,我必须在dotnet生成并最终推动dotnet之前,在dotnet恢复步骤下添加与Target feed相同的提要。 https://docs.microsoft.com/en-us/azure/devops/artifacts/nuget/dotnet-exe?view=azure-devops

,

似乎我通过将Build Service作为贡献者添加到Feed的权限设置中来解决。

这有点令人困惑,但是现在可以正常工作了。

enter image description here

,

正确答案是,在工件设置页面(您可以按照上面的说明访问),您需要向名称模式为 [project_name] Build Service 的用户添加贡献者权限。例如,如果您的项目名称为“IoT”,则需要在如上所示的权限选项卡中的添加用户/组中找到用户“IoT 构建服务”并分配贡献者权限。

,

如果仍然出现错误,您也可以尝试将团队添加为贡献者。

希望它有效。

[project_name][project_name] 团队 - 贡献者

project_name 构建服务(Org_name) - 贡献者

本文链接:https://www.f2er.com/3132344.html

大家都在问