401 Unauthorized to sign image for Azure Container Registry
401 Unauthorized to sign image for Azure Container Registry
我正在尝试将签名图像推送到 Azure 容器注册表。我收到错误 'failed to sign : you are not authorized to perform this operation: server returned 401',即使所有 RBAC 权限都已到位并且我使用正确的凭据登录。
我已经在个人(开发人员)Azure 帐户中创建了一个 ACR。我遵循了 this article 中解释的说明。
我在 Container Registry 资源中启用了 Content Trust。
我在 Azure AD 中注册为用户,并且为容器注册表资源为自己分配了以下角色:
- 所有者
- AcrImageSigner
- AcrPush
我已经使用 az login
登录到 Azure,然后我使用 ac acr login --resource-group <MY_RESOURCE_GROUP> --name <ACR_NAME>
登录到我的容器注册表
*编辑 - 或者,我尝试在我的 ACR 上启用管理员帐户并使用 docker login
和管理员帐户凭据,结果相同。
我可以通过 Azure CLI 查看分配给自己的角色,并且我已检查我是否使用相同的凭据登录。我还尝试启用和禁用管理员访问密钥
这些是我用来将签名图像从我的 windows 机器推送到 ACR 的命令:
set DOCKER_CONTENT_TRUST=1
docker push <ACR_SERVER>/<IMAGE_NAME>:<TAG>
图像已推送到存储库,但未签名。这些是日志:
The push refers to repository [MY_ACR_NAME.azurecr.io/appname]
4a85926cec01: Layer already exists
349c7f00d08e: Layer already exists
370f72f4d447: Layer already exists
8dc6654a61c6: Layer already exists
8fa655db5360: Layer already exists
latest: digest: sha256:<A_VERY_LONG_SHA> size: 1375
Signing and pushing trust metadata
Enter passphrase for root key with ID 0c6a1f8:
Enter passphrase for new repository key with ID 96c45d3:
Repeat passphrase for new repository key with ID 96c45d3:
Finished initializing "MY_ACR_NAME.azurecr.io/appname"
failed to sign MY_ACR_NAME.azurecr.io/appname: you are not authorized to perform this operation: server returned 401.
我希望能够为图像签名,因为我已经通过身份验证并且拥有适当的角色。我希望有人能帮我弄清楚我错过了什么!
- 编辑 2:我试着从 docker 中提取 hello-world 图像并对其进行签名,以消除我无法 'sign third-party images' 的可能性。同样的结果。
The root cause is that the permission list is not recognizable by ACR
if the current login user has a classic subscription administrator
role, such as Service Administrator and Co-Administrator.
如果用户拥有服务管理员凭据,则此时使用用户主体(Azure AD 帐户)对容器进行签名会失败,基本上是在您尝试将容器签名到您自己的私有存储库时。使用服务主体凭据签名和拉取已签名的容器不是问题。
我正在尝试将签名图像推送到 Azure 容器注册表。我收到错误 'failed to sign : you are not authorized to perform this operation: server returned 401',即使所有 RBAC 权限都已到位并且我使用正确的凭据登录。
我已经在个人(开发人员)Azure 帐户中创建了一个 ACR。我遵循了 this article 中解释的说明。 我在 Container Registry 资源中启用了 Content Trust。
我在 Azure AD 中注册为用户,并且为容器注册表资源为自己分配了以下角色: - 所有者 - AcrImageSigner - AcrPush
我已经使用 az login
登录到 Azure,然后我使用 ac acr login --resource-group <MY_RESOURCE_GROUP> --name <ACR_NAME>
*编辑 - 或者,我尝试在我的 ACR 上启用管理员帐户并使用 docker login
和管理员帐户凭据,结果相同。
我可以通过 Azure CLI 查看分配给自己的角色,并且我已检查我是否使用相同的凭据登录。我还尝试启用和禁用管理员访问密钥
这些是我用来将签名图像从我的 windows 机器推送到 ACR 的命令:
set DOCKER_CONTENT_TRUST=1
docker push <ACR_SERVER>/<IMAGE_NAME>:<TAG>
图像已推送到存储库,但未签名。这些是日志:
The push refers to repository [MY_ACR_NAME.azurecr.io/appname]
4a85926cec01: Layer already exists
349c7f00d08e: Layer already exists
370f72f4d447: Layer already exists
8dc6654a61c6: Layer already exists
8fa655db5360: Layer already exists
latest: digest: sha256:<A_VERY_LONG_SHA> size: 1375
Signing and pushing trust metadata
Enter passphrase for root key with ID 0c6a1f8:
Enter passphrase for new repository key with ID 96c45d3:
Repeat passphrase for new repository key with ID 96c45d3:
Finished initializing "MY_ACR_NAME.azurecr.io/appname"
failed to sign MY_ACR_NAME.azurecr.io/appname: you are not authorized to perform this operation: server returned 401.
我希望能够为图像签名,因为我已经通过身份验证并且拥有适当的角色。我希望有人能帮我弄清楚我错过了什么!
- 编辑 2:我试着从 docker 中提取 hello-world 图像并对其进行签名,以消除我无法 'sign third-party images' 的可能性。同样的结果。
The root cause is that the permission list is not recognizable by ACR if the current login user has a classic subscription administrator role, such as Service Administrator and Co-Administrator.
如果用户拥有服务管理员凭据,则此时使用用户主体(Azure AD 帐户)对容器进行签名会失败,基本上是在您尝试将容器签名到您自己的私有存储库时。使用服务主体凭据签名和拉取已签名的容器不是问题。