首页 > 解决方案 > 从 Azure DevOps 限制对 Azure 的部署权限

问题描述

我想锁定对 kudu 工具的访问,例如 https://.scm.azurewebsites.net/DebugConsole 到 azure devops 使用的一组 IP 地址。我已经进入 AzureDevops -> 组织设置 -> 概述,看到我的组织的 Azure Devops 在例如西欧我已经从这里下载了 azure 数据中心的 IP 地址列表:https ://www.microsoft.com/ en-nz/下载/details.aspx?id=41653

我已经进入应用服务-> 网络刀片-> 配置访问限制并上传了 .scm.azurewebsites.net 的例如西欧的 IP 地址列表。

我的理解是 AzureDevops 代理从组织设置中指定的区域运行,因此如果我输入这些 IP 地址,它们应该能够正常访问 kudu 工具,但我收到以下错误:

Failed to deploy web package to App Service.
Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
More Information: Could not connect to the remote computer ("<myappservice>.scm.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.
Error: The remote server returned an error: (403) Forbidden.

如果我删除它部署的 IP 地址没有问题。如何限制对 Azure Devops 的部署访问

标签: azureazure-devopsazure-web-app-service

解决方案


正如 Daniel Mann 的评论所建议的那样 - 您应该使用 Azure RBAC 来限制 Azure Devops 服务主体可以在 Azure 中执行的操作。如果您只允许它管理特定的应用服务 - 它只能这样做。

https://docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal


推荐阅读