I have built a Docker image that I have pushed successfully to an Azure Container Registry (ACR) repository.
But I cannot create an Azure Container Instance running it through Azure Powershell:
> New-AzContainerGroup -ResourceGroupName rg-docker-test -Name framerapi-cg -Location francecentral -Container $container -IpAddressType Public
As I get an error:
The image 'crdockertest.azurecr.io/framerapi:latest' in container group 'framerapi-cg' is not accessible. Please check the image and registry credential.
But I was able to push it to ACR without any issue:
> Connect-AzContainerRegistry -Name crdockertest
Login Succeeded
> docker push --all-tags crdockertest.azurecr.io/framerapi
And I can even pull it:
> docker pull crdockertest.azurecr.io/framerapi
But I've found that by enabling "Admin user" for the registry I can create the container group using the generated credentials:
> $pwd = ConvertTo-SecureString -AsPlainText ...
> $credentials = New-AzContainerGroupImageRegistryCredentialObject -Server crdockertest.azurecr.io -Username crdockertest -Password $pwd
> New-AzContainerGroup -ResourceGroupName rg-docker-test -Name framerapi-cg -Location francecentral -Container $container -IpAddressType Public -ImageRegistryCredential $credentials
Why the usual authentication via Connect-AzContainerRegistry (and Connect-AzAccount if it matters) is not working?
What is the fix?
As if I understand well the "Admin user" mode is not suited for production, only for dev/testing.