The resource with name 'name' and type 'Microsoft.ContainerRegistry/registries' could not be found in subscription

Susheel Bhatt 351 Reputation points
2023-03-10T13:42:26.9466667+00:00

I am working on a script where I want to run az acr import. The command tries to list the repository but fails with the error: The resource with name 'name' and type 'Microsoft.ContainerRegistry/registries' could not be found in subscription

As you can see in the screenshot below. This registry is indeed present in the subscription. I am able to login, run docker push as well which completes successfully. But az acr show returns a failure.

Please note that I am the owner of this subscription.

enter image description here

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
390 questions
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
639 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Shailendra Singh Chauhan 5 Reputation points
    2024-02-19T17:26:43.95+00:00

    I had the same issue, and I followed/checked everything in this thread.

    1. Provider was registered
    2. Created the ACR
    3. Visible in portal
    4. Not visible by az cli In my case, I have to just wait for 10 -15 minutes for it to work as expected.
    1 person found this answer helpful.
    0 comments No comments

  2. Andrei Barbu 2,576 Reputation points Microsoft Employee
    2023-03-10T14:07:13.32+00:00

    Hello Sushell!

    1 - Can you try to run "az acr list -o table" and see if that displays your ACR?

    2 - Can you try to add "--subscription <subscription-id>" next to "az acr show" or "az acr list" or run "az account set --subscription <subscription-id>"?

    3 - Can you try to run the same commands from Cloud Shell in order to attempt isolating the issue and understand if it is something general or related to your terminal?

    If these suggestions helped you address the issue, please "Accept as Answer" and Upvote if it helped, so that it can help others in the community looking for help on similar topics.

    Thank you!


  3. Curtis Barrett 0 Reputation points
    2024-04-17T14:55:13.3066667+00:00

    Adding to this as I came across this same issue. Was able to az acr login to my ACR but couldn't actually do the az acr import that I wanted.

    Turns out I was missing ACR level permissions for my managed identity. Not sure exactly what permissions are required. But the Contributor role fixed the issue. However, merely having the ACR Push role was not up to the task.

    Initial setup:
    az login -i //I'm using a managed Identity on a self-hosted build agent

    az account set --subscription <subscription id>

    az acr list -o table

    <Nothing here, results were an empty line>

    After adding the Contributor Role on top of ACR Push I reran and got

    NAME RESOURCE GROUP LOCATION SKU LOGIN SERVER CREATION DATE ADMIN ENABLED


    MyACR MyResourceGroup region Premium myacr.azurecr.io 2024-04-14T04:30:29Z False

    Hope this helps you in your effort to fix this.

    0 comments No comments