简体   繁体   English

Azure 容器注册表权限

[英]Azure Container Registry Permissions

Im trying to setup simple read only access using Azure AD to an Azure container registry.我正在尝试使用 Azure AD 设置对 Azure 容器注册表的简单只读访问。

I have managed to setup a service principal with read only access no problem, but when creating an AD account and using IAM on the registry I cannot login using az acr.我设法设置了一个只读访问的服务主体,没有问题,但是在创建 AD 帐户并在注册表上使用 IAM 时,我无法使用 az acr 登录。

I have created an account in Azure AD, added is to the registry IAM, assigned it reader role (this matches the role given to the service principal) but receive the following error logging in with az acr我在 Azure AD 中创建了一个帐户,添加到注册表 IAM,为其分配了读者角色(这与赋予服务主体的角色相匹配),但在使用 az acr 登录时收到以下错误

The client 'xxxx@xxxxxx.co.uk' with object id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' does not have authorization to perform action 'Microsoft.ContainerRegistry/registries/listCredentials/action' over scope '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourceGroups/xxxxxxxxxxxxx/providers/Microsoft.ContainerRegistry/registries/xxxxxxxxxxxx'.

The only way I can get logged in using the az acr is to assign IAM contributor permissions on the resource group.我可以使用 az acr 登录的唯一方法是为资源组分配 IAM 参与者权限。

Is there something im missing?我有什么遗漏吗?

tia蒂亚

It is a RBAC issue.这是一个 RBAC 问题。

Could you please try to use this docker login to login ACR?您能否尝试使用此docker login登录 ACR?

You can also log in directly with a service principal .您也可以直接使用service principal登录。 Provide the app ID and password of the service principal to the docker login command:向 docker login 命令提供服务主体的应用程序 ID密码

 docker login myregistry.azurecr.io -u xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -p myPassword

When you log in with az acr login , the CLI uses the token created when you executed az login to seamlessly authenticate your session with your registry.当您使用az acr login ,CLI 使用在您执行az login时创建的令牌来无缝验证您与注册表的会话。

Please check your service principal permission, also you can create a new service principal and assign to this group .请检查您的服务主体权限,您也可以创建新的服务主体并分配给该

az ad sp create-for-rbac -n "http://my-app" --role reader --scopes /subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/mygroup

The available roles are:可用的角色是:

Reader : pull读者:拉
Contributor : pull and push贡献者:拉和推
Owner : pull, push, and assign roles to other users所有者:拉、推和分配角色给其他用户

Note:笔记:

When you use az acr login to login acr, this command will use the token created when you executed az login to login it.当您使用az acr login登录 acr 时,此命令将使用您执行az login时创建的令牌登录。 This token not equal to your service principal(reader).此令牌等于您的服务主体(读者)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM