如何为项目设置构建授权范围? [英] How do I set the build authorization scope for my project?
问题描述
现在,由于项目构建用户无权访问软件包提要,因此我的NuGet还原失败.
Right now my NuGet restore fails since the project build user doesn't have contributor access to the package feed.
/usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5):错误:无法加载源pkgs.dev.azure.com [..] index.json的服务索引. /usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5):错误:响应状态代码未指示成功:403(禁止-用户"xxxxxxx"缺少完成此操作的权限.您需要拥有"ReadPackages".
/usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error : Unable to load the service index for source pkgs.dev.azure.com[..]index.json. /usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error : Response status code does not indicate success: 403 (Forbidden - User 'xxxxxxx' lacks permission to complete this action. You need to have 'ReadPackages'.
解决方案是将构建授权范围从当前项目更改为项目集合.如此处所示,这似乎非常可行:
The solution is to change the build authorization scope from current project to project collection. This seems very doable as seen here:
https://docs .microsoft.com/en-us/azure/devops/pipelines/build/options?view = azure-devops
但是,在DevOps的众多菜单中,可以在何处设置此范围?
But where, in DevOps' myriad menus, can this scope be set?
推荐答案
There was a workaround for this 403 error posted a few hours ago: https://developercommunity.visualstudio.com/content/problem/795493/403-error-during-nuget-restore.html
简而言之,这似乎影响到连接到私有提要的新项目.建议的解决方法如下:
In short, this seems to affect new projects connecting to a private feed. Here's the suggested work around:
-
在构建失败的项目中单击工件"
选择要在构建中使用的供稿,然后单击右上角的齿轮
点击"Feed设置"
转到权限"标签
点击标签右侧的三个点[...]
点击允许项目范围的构建"
这将添加OP发布的错误所抱怨的相关用户权限.希望微软会对此进行适当的修复.
This adds the relevant user permissions that the error the OP posted was complaining about. Hopefully Microsoft will make a proper fix for this soon.
在开发者社区页面上对Tim Lynch表示全信.
Full credit to Tim Lynch from the developer community page.
这篇关于如何为项目设置构建授权范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!