【问题标题】:Azure DevOps Pipelines not respecting RBAC permissionsAzure DevOps Pipelines 不尊重 RBAC 权限
【发布时间】:2019-09-13 07:11:24
【问题描述】:

我已使用服务主体配置 Azure DevOps 以访问一个特定的资源组。我原以为 Azure DevOps 只能部署到该组下的资源,但似乎并非如此。我能够连接来自其他资源组的代理,然后毫无问题地部署到它们。

如果代理可以绕过所有权限,那么在“Azure DevOps”中配置服务主体有什么意义?

Configuration:
Azure Portal
1. Created AD in Azure Portal. Created App under AD with client secret.
2. Granted 'contributor' role to App created in Step-1 with resource group scope.
3. Created two resource groups - RG1 and RG2 with one VM in each.
4. Granted role assignment to App created in step-1 for RG1 only. RG2 has no role assignments.

Azure DevOps
5. Connect Azure DevOps organization with Portal using AD connect.
6. Created service connection by going to Projects-> Service Principal(SP) -> Azure Resource Manager with Service Principal credentials (see step-1 above).
7. Created new pipeline and deployment group. Copied the deployment group agent code and ran it on both VMs in RG1 and RG2.

实际结果: 两个虚拟机作为部署组下的目标连接良好。 Pipeline 能够成功部署到两个 VM。 即使不存在服务连接,管道也能够部署到虚拟机

预期结果: 只有 RG1 下的 VM 应该基于 RBAC 连接。 管道应该只能部署到 RG1 下的 VM 而不能部署到 RG2。 如果未定义服务连接,则管道应该无法部署。

解决方法:也许安装此扩展程序 (https://github.com/maikvandergaag/msft-extensions/wiki/Azure-RBAC) 会有所帮助,但我会尽可能避免它。

【问题讨论】:

    标签: azure azure-devops azure-pipelines azure-rbac


    【解决方案1】:

    我相信您对 RBAC 的理解适用于 Azure 资源和 VM 资源。但是您已经通过将部署代理安装到 VM 中来覆盖权限。

    在 IAAS 场景中,您已经使用部署代理授予了权限。

    在 PAAS 场景中,将遵守 RBAC,因为您将使用服务端点。

    【讨论】:

    • 谢谢@arunprasath。所以基本上,我不应该注册代理并使用服务端点。希望这将使 RBAC 发挥作用。但是,我将如何为 Azure DevOps 中的发布管道配置部署组。是否没有简单的方法可以将工件部署到支持 RBAC 策略的 VM/RG?
    • 您需要使用部署组代理,但不能使用 RBAC。代理授予功能提供安装包的完全访问权限。
    猜你喜欢
    • 2022-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-23
    • 2020-01-14
    相关资源
    最近更新 更多