az acr - Unable to find repository in case of multiple subscription on single account

az acr login
az cli
az commands
azure cli examples
azure portal cli
azure cli pricing
ls command in azure cli
azure cli wiki

I'm using Azure CLI v2.0.62.

I do have multiple subscriptions - S1, S2, S3, S4 - in Azure on the single account.

I'm executing below script to insert dynamic value into repository:

az login
az acr build "ParentStorage" --platform windows -f Dockerfile -t ChildRepository:<dynamicValue>

Here, ParentStorage is of Storage Account type and ChileRepository is of Repository type.

At first, when login command gets executed, it gives me list of available subscription. But after executing az acr build... command it is throwing error message as below:

Error

The resource with name 'ParentStorage' and type 'Microsoft.ContainerRegistry/registries' could not be found in subscription 'Visual Studio Professional (ID)'.

What I have found till now is, it is trying to search under my Visual Studio subscription (S1). As S1 was the default subscription and repository was in S2. So I set S2 as default subscription and tried again but it didn't work.

Event when I tried to execute below command, it threw the same error:

az acr show --name ParentStorage

P.S.: I tried to login with specific subscription but unable to do so.

Please let me know what is I'm missing here.

For your issue, it seems your registry is not in the current subscription. When you use the CLI command az login then you log in with a default subscription. For you, it seems the "Visual Studio Professional (ID)" is the default. You should check if your registry is in the current subscription. If not, you should set that subscription as the current subscription through the CLI command:

az account set --subscription subscription_id

Then I suggest you'd better check if the registry exists again with the CLI command:

az acr show -n acr_name

It will show the information of your registry. This time, you can build the image with the CLI command az acr build as you want.

Also, you can set the subscription in the login time with the parameter --subscription through the CLI command az login.

If you have more questions, please let me know. Or if you think it's helpful you can accept it as the answer.

`az acr login` does not work with `--subscription` argument � Issue , az acr login --name REG_NAME --resource-group utv --subscription REQUIRED_SUB_NAME Unable to get AAD authorization tokens with� Update the attributes of a repository or image in an Azure Container Registry. Delete an image manifest by tag. This deletes the manifest referenced by 'hello-world:latest' and all other tags referencing the same manifest. az acr repository delete -n MyRegistry --image hello-world:latest Delete an

Just adding an additional thing by following the answer provided in here

We can use below command to build with specific subscription id so that whenever the multiple users want to execute this command with their different default subscription id, they don't need to make other subscription as their default.

az acr build --subscription $SubscriptionId -r $registry --platform Windows -f Dockerfile -t XYZ:v$version obj

Hope this helps others too.

Unable to login with `az acr login` while using RBAC with roles , The current documentation currently states Using az acr login with Azure But I just don't understand the purpose for AcrPull in that case which seems useless to me. Do you have multiple subscriptions by chance? but does not return repository with only AcrPull , so I don't think it is a subscription issue. Important. The admin user account is designed for a single user to access the registry, mainly for testing purposes. We do not recommend sharing the admin account credentials with multiple users.

I ran into this and found another issue. The service provider (SP) I was using only had the "Acr Push" role. I had to add the "Contributor" role to resolve the issue. So it appears "Acr Push" does not have enough permissions to see the ACR resource.

Frequently asked questions, How do I get admin credentials for a container registry? The admin user account is designed for a single user to access the registry, mainly for testing purposes. We do not recommend sharing the admin account credentials with multiple users. az acr repository show-manifests -n myRegistry --repository� A: If you're the organization Owner or Azure subscription Account Administrator, check your subscription status in the Account Center, then try to fix your subscription. Your paid settings are restored. Or you can link your organization to another Azure subscription by unlinking your organization from the disabled subscription. While your

Registry authentication options, Individual AD identity, az acr login in Azure CLI, Interactive push/pull by developers, and push access, Single account per registry, not recommended for multiple users. Repository-scoped access token, docker login az more guidance, see Azure Container Registry authentication with service principals. In this case, provide your users access to the Reader or Contributor role. These roles allow docker pull, docker push, az acr list, az acr build, and other capabilities. Access Resource Manager. Azure Resource Manager access is required for the Azure portal and registry management with the Azure CLI.

Best Practices for security in Azure Container Registry, With Security Center, you can get automatic scans of your registries, and it's actually very helpful. Option 1: Disable ACR Admin User from the Azure Portal You can subscribe to events that happen inside the Azure Container and you can have a single ACR for a use case that have multiple images,� The Arizona Judicial Branch is pleased to offer Public Access to Court Case Information, a valuable online service providing a resource for information about court cases from 153 out of 180 courts in Arizona.

Get Started with Bitnami Charts using the Azure Kubernetes Service , In case you haven't, install it using these instructions. az login. If you have multiple subscriptions, you can optionally set the subscription you To configure your AKS cluster to use your ACR, you need to indicate Kubernetes You will also be able to see your cluster in the Microsoft Azure dashboard,� az acr login fails if value of --subscription argument does not match active subscription as shown by az account show. To Reproduce. Set active subscrption. az account set --subscription SOME_SUB_NAME Try acr login into another sub. Observe "Access denied" message. I then get prompted for username.

Comments
  • Are you saying that when you try az account set -s S2 you get an error? You will need to be logged into the S2 subscription for your az acr commands to work. Another option is to create a new ACR in S1.
  • @KenWMSFT, no I didn't get an error in setting the default account to S2. But still when I executed the command az acr build... mentioned in quertion - at that time I got an error.
  • I have already tried this and also mentioned the same in the details I have provided (below the Error message). Thank you for the efforts, but please let me know if there is any other way I can try with.
  • @PratikSoni What do you mean? The error shows the registry is not in the subscription "Visual Studio Professional (ID)".
  • Sorry to keep you waiting. The issue that I couldn't get success last time is I still was looking into a wrong subscription. But now I'm able to get it as pointed now to a right subscription. Marked as answer.
  • @PratikSoni Well, no one can be always careful on all the things. That's OK.