【问题标题】:Where are authorizations listed for modified Azure DevOps YAML pipelines accessing resources?修改后的 Azure DevOps YAML 管道访问资源的授权在哪里列出?
【发布时间】:2020-11-14 18:23:32
【问题描述】:

我有一个包含以下内容的管道:

resources:         
  repositories:
  - repository: repo
    type: git
    name: TEST-staging

steps: 
- checkout: repo

当管道运行时,我收到以下警告:

This pipeline needs permission to access a resource before this run can continue

提示我授予访问权限:

Granting permission here will permit the use of Repository 'TEST-staging' for all waiting and future runs of this pipeline.

我希望能够审核和修改哪些管道可以访问哪些存储库。 这些权限在哪里列出?

编辑: 当管道命名存储库时,系统会提示用户允许访问,例如- checkout: repo 然而,在使用 -checkout: self 时不会提示用户允许访问,即使它是同一个 repo。

编辑:Limit job authorization scope to current project for non-release pipelinesLimit job authorization scope to referenced Azure DevOps repositories 的组织设置目前一直处于禁用状态。

编辑:此常见问题解答问题类似于我的问题:Why am I am prompted to authorize resources the first time I try to check out a different repository?。该常见问题解答导致此文档:Troubleshooting authorization for a YAML pipeline。该文档包含:

当您第一次创建管道时,所有资源 在 YAML 文件中被引用 被自动授权使用 由管道提供,前提是您是用户角色的成员 对于那个资源。因此,YAML 文件中引用的资源 在管道创建时自动授权。当你 对 YAML 文件进行更改并添加其他资源......然后 构建失败并出现资源授权错误......在这种情况下, 您将看到授权失败构建资源的选项。 如果您是资源的用户角色的成员,您可以选择 这个选项。一旦资源被授权,你可以开始一个新的 构建。

编辑: This seems to be the work item for the change 导致我们被提示允许访问。

所以,我被引导得出以下结论:

  1. @Leo 正确回答了“这些权限在哪里列出?”这个问题。除非将 YAML resource 添加到现有管道中
  2. 当 YAML resources 被修改或编辑时,系统会提示用户授权该访问即使该访问已通过用户角色授权
  3. 我重新命名了这篇文章,希望它更清楚地提出问题,因为到目前为止似乎没有任何地方列出临时授权

【问题讨论】:

    标签: azure-devops azure-pipelines azure-repos


    【解决方案1】:

    我希望能够审核和修改哪些管道可以访问哪些存储库。这些权限在哪里列出?

    根据文档Pipeline permissions and security roles,我们可以知道:

    对于权限,您可以通过设置 允许或拒绝的权限状态,对于安全组或 个人用户。对于角色,您可以将用户或组添加到该角色。

    因此,管道的权限与执行管道的用户相关。

    为了能够审计和修改哪些管道可以访问哪些存储库,我们可以使用更高权限的帐户授予当前用户访问 TEST-staging 存储库的权限:

    Organization Settings->Users->选择当前用户->三个点->Manager User:

    如果当前用户有直接访问repo的权限,那么当这个用户执行pipeline时,pipeline就拥有repo资源的访问权限。

    【讨论】:

    • 嗨/谢谢@leo!我检查了org settings>users>manage,他们有Project Administrators 角色。但是,在第一次运行时,用户仍然会收到 "Permit" 提示(原始帖子中的第二个链接)。所以,这似乎是错误的,直到他们完成 "Permit" 提示:"If the current user has permission to directly access the repo, then when this user executes the pipeline, the pipeline will have the permission to access the resource repo." 另外,我仍然不知道如何避免 "Permit" 提示,我仍然不知道如何查看允许的内容。
    • 附加上下文:当管道命名存储库时提示用户允许访问,例如- checkout: repo 然而,使用-checkout: self 时不会提示用户允许访问,即使它是同一个仓库。我也会用这个更新原来的帖子。
    • @sukoneck,在这种情况下,请转到org settings>Settings> 并检查选项Limit job authorization scope to current project for non-release pipelinesLimit job authorization scope to referenced Azure DevOps repositories 是否启用?如果是,请尝试禁用它,然后重新检查此问题。
    • 我确认这两个选项都被禁用了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-06
    • 1970-01-01
    • 1970-01-01
    • 2020-05-23
    相关资源
    最近更新 更多