问题描述

在使用App Service for container时,在从ACR(Azure Container Registry)中获取应用的镜像时,需要使用对应的权限。默认情况为在ACR中启用Admin User权限,在App Service中使用Admin User访问拉取镜像。

【Azure 应用服务】App Service for Container中配置与ACR(Azure Container Registry)的RABC权限

而为了更准确的控制权限,在ACR中需要为App Service赋予什么样的RBAC 角色才能通过Container Setting选择镜像并拉取更新呢?

 

问题解答

一种是使用Contributor权限

授予完全访问权限来管理所有资源,但不允许在 Azure RBAC 中分配角色或在 Azure 蓝图中管理分配,也不允许共享映像库。https://docs.microsoft.com/zh-cn/azure/role-based-access-control/built-in-roles#contributor

如:在App Service门户界面更改ACR镜像操作时,其中的持续集成功能,是会对ACR资源进行更新操作,所以需要App Service中有ACR的Contributor操作权限。

【Azure 应用服务】App Service for Container中配置与ACR(Azure Container Registry)的RABC权限

一种是通过自定义角色,自定义组合ACR中的权限,以避免给予用户过度的权限

使用 Azure 门户创建 Azure 自定义角色

可以使用 Azure 门户、Azure PowerShell、Azure CLI 或 REST API 创建自定义角色。 


 

经测试,通过自定义角色的方式,来组合ACR的权限授权给用户,这样就可以开放适度的管理权限给用户,如以下权限列表可以用于App Service 更新镜像的权限设定:

【Azure 应用服务】App Service for Container中配置与ACR(Azure Container Registry)的RABC权限

 

 

参考资料

Configure App Service to deploy the image from the registry: https://docs.microsoft.com/en-us/azure/app-service/tutorial-custom-container?pivots=container-linux

使用 Azure 门户创建 Azure 自定义角色: https://docs.microsoft.com/zh-cn/azure/role-based-access-control/custom-roles-portal#clone-a-role

相关文章:

  • 2021-01-22
  • 2021-08-26
  • 2021-05-30
  • 2022-01-20
  • 2021-08-17
  • 2021-08-22
  • 2021-08-18
  • 2021-05-06
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2021-09-24
  • 2021-03-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案