Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az create container requires credentials for ACR image with anonymous pull access #30518

Open
MaxHorstmann opened this issue Dec 13, 2024 · 6 comments
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. Container Instances az container Container Registry az acr Service Attention This issue is responsible by Azure service team. Similar-Issue

Comments

@MaxHorstmann
Copy link
Contributor

MaxHorstmann commented Dec 13, 2024

Describe the bug

Azure Container Registry (ACR) supports anonymous pull access, but az create container always requires credentials when azurecr.io is detected in the image URL.

This makes it unnecessarily difficult to create a container group using a container image hosted in ACR with anonymous pull access enabled.

Related command

Here's my ACR with anonymous pull access enabled...

$ az acr show -n myacrwithanonymouspullaccess | grep anonymous
  "anonymousPullEnabled": true,

... so, no credentials are required to pull an image from it. Look, I can do it from my local machine without logging in...

$ docker pull myacrwithanonymouspullaccess.azurecr.io/myimage:latest
latest: Pulling from myimage
Digest: sha256:d063655c..81
Status: Image is up to date for myacrwithanonymouspullaccess.azurecr.io/myimage:latest

... so I should be able to create a container group without providing any credentials. But az container create detects azurecr.io in the image URL (right here) and prompts for registry username and password:

$ az container create -g myrg --name aci-test --image myacrwithanonymouspullaccess.azurecr.io/myimage:latest 
  --cpu 1 --memory 1                                             
Image registry username: 

Looks like as a workaround, it's possible to just provide random invalid credentials:

$ az container create -g myrg --name aci-test --image myacrwithanonymouspullaccess.azurecr.io/myimage:latest 
  --cpu 1 --memory 1  --registry-password "foo" --registry-username "foo"                                           

Errors

n/a there's no error message, the error is that the command shouldn't prompt for credentials

Issue script & Debug output

n/a

Expected behavior

The error is that az container create prompts for credentials in the above scenario when it shouldn't, because the image might be hosted in ACR with anonymous pull access enabled.

Environment Summary

{
  "azure-cli": "2.67.0",
  "azure-cli-core": "2.67.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "account": "0.2.5",
    "containerapp": "1.1.0b1",
    "devcenter": "6.1.0"
  }
}

Additional context

No response

@MaxHorstmann MaxHorstmann added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Dec 13, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 13, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. Container Registry az acr Container Instances az container labels Dec 13, 2024
@MaxHorstmann MaxHorstmann changed the title az create container won't accept ACR image with anonymous pull access, requires credentials az create container requires credentials for ACR image with anonymous pull access Dec 13, 2024
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dkkapur.

Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @toddysm, @luisdlp, @northtyphoon, @terencet-dev.

Copy link

Here are some similar issues that might help you. Please check if they can solve your problem.

Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dkkapur.

Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @toddysm, @luisdlp, @northtyphoon, @terencet-dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. Container Instances az container Container Registry az acr Service Attention This issue is responsible by Azure service team. Similar-Issue
Projects
None yet
Development

No branches or pull requests

2 participants