Search code examples
azureazure-cliazure-container-registryazure-container-apps

Trying to build container app from ACR throwing unauthorized error


Have a question on Azure need to deploy an azure container app by pulling the image from azure container registry from AZ

Steps:

1- az login -successful
2- az acr login appdev - successful
3- az containerapp create --name apptest --resource-group \
testapp --image appdev.azurecr.io/dev/dev-app:latest \
--environment MyContainerappEnv \

Throwing this error:

the following field(s) are either invalid or missing. Invalid value: "appdev.azurecr.io/dev/dev-app:latest": GET https:?scope=repository%3Adev%2Fdev-app%3Apull&service=appdev.azurecr.io: UNAUTHORIZED: authentication required, visit https://aka.ms/acr/authorization for more information.: template.containers.apptest.image

I have already logged in successfully and able to pull the image using

docker pull appdev.azurecr.io/dev/dev-app:latest

Also this is successful

az acr login --name appdev
Login Succeeded

Able to push the image to ACR . I already have contributor permission to the subscription.

Can anyone help? Thanks


Solution

  • this worked:

    az containerapp create --name apptest \
      --resource-group testapp \
      --image appdev.azurecr.io/dev/dev-app:latest \
      --environment MyContainerappEnv \
      --registry-server appdev.azurecr.io //adding this