az acr build doesn't support new ACR with ABAC and a suffix in its login server name
Describe the bug
First of all the whole documentation in general of az acr is not very clear about the new ACRs with a system assigned random suffix in its login server name. For instance, as a user, let's say my ACR name is myacr, the login server is myacr-randomsuffix.azurecr.io, why I as a user can log in with az acr login --name myacr, but a GitHub service principal cannot (it gets "The resource with name 'XXXXX' and type 'Microsoft.ContainerRegistry/registries' could not be found in subscription 'XXXXXXX'"), so that it muse use az acr login --name myacr --suffix randomsuffix to succeed. Which is fine for me.
However, in az acr build this problem comes again. There, there's even no parameter --suffix and without which, the command in GitHub workflow will fail (similar error message).
What should we do here?
Related command
az acr build -r myacr -t myimage . -- wrong
az acr build -r myacr-randomsuffix -t myimage . -- wrong
az acr build -r myacr-randomsuffix.azurecr.io -t myimage . -- wrong again.
So where's the equivalent command to az acr login, with --suffix?
Errors
"The resource with name 'myacr' and type 'Microsoft.ContainerRegistry/registries' could not be found in subscription 'XXXXXXX'"
Issue script & Debug output
See above
Expected behavior
That whether there's a parameter --suffix in az acr build, or, to make it work by omitting the suffix (I still don't see why there's the difference between a human user (which doesn't need to add --suffix in az acr login and a service principal, which needs it)).
Environment Summary
Not really relevant, it's the GitHub Workflow Ubuntu 22.04 or 24.04.
Additional context
No response
route to acr team
@johnsonshi @leodewang could you please look into this issue? thanks
We're looking into it.
@xi4n are you using the latest version? Our engineers tried to repro it in the latest version and everything worked fine.
az acr build --registry dnlregistryname --image helloacrtasks:v1 --file Dockerfile .
az acr build --registry dddddddddddd-adfvbqhmd2b4g6dg.azurecr.io --image hello-world --file Dockerfile .
Both worked fine. Can you confirm your CLI version?
@lizMSFT are you able to take a look and help?
@xi4n The error indicates that the resource cannot be found in the specified subscription. Please try again using the --resource-group <rg> parameter, for example: az acr build -r myacr --resource-group myrg -t myimage .
@xi4n as the issue is most likely an issue with missing --resource-group parameter, please try again on your side. If the issue persists, please feel free to reopen this issue.