如何为我的项目设置构建授权范围? [英] How do I set the build authorization scope for my project?
问题描述
现在我的 NuGet 还原失败,因为项目构建用户没有对包提要的贡献者访问权限.
<块引用>/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".
解决方案是将构建授权范围从当前项目改为项目集合.这似乎非常可行,如下所示:
<块引用>选择您尝试在构建中使用的提要,然后单击右上角的齿轮
点击Feed 设置"
转到权限"标签
点击选项卡右侧出现的 3 个点 [...]
点击允许项目范围的构建"
这会添加 OP 发布的错误所抱怨的相关用户权限.希望微软尽快为此做出适当的修复.
完全归功于开发者社区页面的 Tim Lynch.
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): 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
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:
Click "Artifacts" in the project with the failing build
Select the feed you were trying to consume in your build and click the cog in the top right corner
Click "Feed Settings"
Go to the Permissions tab
Click the 3 dots [...] that appeared to the right of the tab
Click "Allow project-scoped builds"
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.
Full credit to Tim Lynch from the developer community page.
这篇关于如何为我的项目设置构建授权范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!