简体   繁体   English

无需订阅所有者即可将 Azure Kubernetes 服务 (AKS) 附加到 Azure 容器注册表 (ACR)

[英]Attach Azure Kubernetes Service (AKS) to Azure Container Registry (ACR) without being Subscription Owner

I'm deploying AKS via ARM template and Azure DevOps pipeline and want to automate attachment to ACR我正在通过 ARM 模板和 Azure DevOps 管道部署 AKS,并希望自动连接到 ACR

To do so I need to execute az aks update --name $(clusterName) --resource-group $(rgName) --attach-acr $(containerRegistryName)为此,我需要执行az aks update --name $(clusterName) --resource-group $(rgName) --attach-acr $(containerRegistryName)

..but that requires Owner on Subscription level and I don't want service principle to have it ..但是这需要订阅级别的所有者,我不希望服务原则拥有它

Is there any workaround available?有没有可用的解决方法?

You only workaround would be to create a custom role that only allows to assign permissions to that specific resource.您唯一的解决方法是创建一个仅允许为该特定资源分配权限的自定义角色。 that would look like something like this:看起来像这样:

$role = Get-AzureRmRoleDefinition "Virtual Machine Contributor"
$role.Id = $null
$role.Name = "xxx"
$role.Description = "yyy"
$role.Actions.Clear()
$role.Actions.Add("Microsoft.Authorization/roleAssignments/write")
$role.AssignableScopes.Clear()

$scope = "your azure container registry resourceId"
$role.AssignableScopes.Add($scope)
$def = New-AzureRmRoleDefinition -Role $role

maybe you need to add read permissions as well, due to how az cli is implemented, but in essence write should be enough由于 az cli 的实现方式,您可能还需要添加读取权限,但本质上写入应该就足够了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure容器注册表(ACR)SKU - Azure Container Registry (ACR) SKUs 没有使用 Azure 容器注册表 (ACR) 使用 ARM 模板创建 Azure AKS 集群的选项 - No option to Create Azure AKS cluster with Azure container registry (ACR) using ARM template 了解Azure Kubernetes服务(AKS) - Understanding Azure Kubernetes Service (AKS) 从Azure Kubernetes Service使用Azure容器注册表进行身份验证时发出的问题 - Issue of while Authenticate with Azure Container Registry from Azure Kubernetes Service 通过 Terraform 中 azure 应用服务的角色分配访问 azure 容器注册表 (ACR) - Access azure container registry (ACR) by role assignment for azure app service in Terraform Azure Web 服务环境变量不适用于 Azure 容器注册表 (ACR) 映像 - Azure Web Service env-variables not working with Azure Container Registry (ACR) image 如何在 azure (AKS) 中的 Kube.netes 集群中附加磁盘 - How to attach a disk in Kubernetes cluster in azure (AKS) 设置Helm图以部署推送到Azure容器注册表(ACR)的Nodejs服务 - Setting of Helm chart to deploy Nodejs service which pushed to Azure Container Registry (ACR) 在 Azure Kubernetes (AKS) 容器内使用 blobfuse - use blobfuse inside an Azure Kubernetes (AKS) container Kubernetes上的Azure容器服务 - Kubernetes on Azure Container Service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM