ibe*_*dev 33 nuget azure-devops azure-pipelines azure-artifacts
我收到一个错误:
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 存储库位于 GitHub 中。不确定谁被认为是用户,但我不知道要修改哪些其他权限
ibe*_*dev 67
似乎我通过将构建服务作为贡献者添加到提要的权限设置来修复。
这有点令人困惑 tbh 但它现在工作正常。
小智 24
截至 2022 年 7 月,至少 Azure Devops Web 界面发生了一些变化。虽然基本面看起来没有变化,但...前面提到的按钮已经消失了。以下是我在撰写本文时想到的步骤。摘自一篇抱怨的博客文章,其中有更多细节和上下文。
创建一个新的 feed,将范围设置为项目:
默认情况下,为新提要创建的权限列表如下。请注意,用户或组默认organisation_name Build Service (project_name)具有该角色。Collaborator这可能是用户绊倒的关键绊脚石。
您无法更改角色;您必须删除organisation_name Build Service (project_name)用户或组,然后使用角色再次添加它Contributor。
Gab*_*son 22
对于像我这样完全迷路的人,diegosasw说的页面是在Artifacts菜单里,不是在Task里,也不是在Pipeline里:
脚步:
小智 8
正确的答案是,在工件设置页面(您可以按照上面的说明进行访问),您需要向名称模式为 [project_name] Build Service 的用户添加贡献者权限。例如,如果您的项目名称是“IoT”,则需要在如上所示的权限选项卡中的添加用户/组中找到用户“IoT Build Service”,并分配贡献者权限。
请参阅ArkadiuszKozie-6872此处的答案:
 https://learn.microsoft.com/en-us/answers/questions/723164/granting-read-privileges-to-azure-artifact-feed.html
也必须同意Contributor,Project Collection Build Service (<YOUR-ORG-NAME>)这为我解决了这个问题。
小智 6
很棒的发现!在 ... 菜单中允许项目范围的构建对我有用。
但是为了能够将包从 Azure Pipelines 推送到 Azure Artifacts 提要,我必须在 dotnet build 和最后 dotnet push 之前的 dotnet restore 步骤下添加与 Target feed 相同的提要。https://docs.microsoft.com/en-us/azure/devops/artifacts/nuget/dotnet-exe?view=azure-devops
| 归档时间: | 
 | 
| 查看次数: | 15940 次 | 
| 最近记录: |