如何修复 (TasksOperationsNotAllowed) ACR 任务对注册表 <containerRegistryName> 和 <password> 的请求不被允许

问题描述 投票:0回答:1

在 Azure Cloud Shell 上运行以下命令时出现 TasksOperationsNotAllowed 错误。怎么解决?

命令: az acr build --registry $REGISTRYNAME --image expressimage .

错误: (TasksOperationsNotAllowed) ACR 任务请求注册表且不被允许。请在 http://aka.ms/azuresupport 提交 Azure 支持请求以获得帮助。代码:TasksOperationsNotAllowed 消息:ACR 任务请求注册表但不被允许。请在 http://aka.ms/azuresupport 提交 Azure 支持请求以获得帮助。目标:请求

在 Azure Cloud Shell 上运行以下命令时出现 TasksOperationsNotAllowed 错误。怎么解决?

命令: az acr build --registry $REGISTRYNAME --image expressimage .

错误: (TasksOperationsNotAllowed) ACR 任务请求注册表且不被允许。请在 http://aka.ms/azuresupport 提交 Azure 支持请求以获得帮助。代码:TasksOperationsNotAllowed 消息:ACR 任务请求注册表但不被允许。请在 http://aka.ms/azuresupport 提交 Azure 支持请求以获得帮助。目标:请求

azure azure-container-registry azure-container-service
1个回答
0
投票

当不允许 ACR 任务请求注册表和密码时,会出现错误消息“TasksOperationsNotAllowed”。要解决此问题,您需要检查用于对 Azure CLI 进行身份验证的用户帐户是否具有执行 ACR 任务所需的权限。如果用户帐户没有所需的权限,则需要为该用户帐户授予必要的权限。您还可以尝试注销并重新登录 Azure CLI 以刷新身份验证令牌。您需要为容器注册表启用“管理员用户”选项。此选项允许您使用用户名和密码向注册表进行身份验证。要启用此选项,请按照下列步骤操作:

  1. 转到 Azure 门户并导航到容器注册表。
  2. 单击“设置”下的“访问键”。
  3. 将“管理员用户”选项切换为“启用”。
  4. 复制页面上显示的用户名和密码值。
  5. 使用这些值在命令中向注册表进行身份验证。 enter image description here

或来自 Az CLI

az acr build --registry $REGISTRYNAME --image expressimage --username <username> --password <password> .

完成后,您可以将映像推送到注册表并进行相应部署

az login
az acr login --name <youracrname>
docker tag <the_name_you_want_to_show_in_ACR> <youracrname>.azurecr.io/<the_image_name_which_you_built>

docker push <youracrname>.azurecr.io/<the_name_you_want_to_show_in_ACR> 

enter image description here

enter image description here

参考资料:

© www.soinside.com 2019 - 2024. All rights reserved.