Search code examples
azureazure-devopscontainersregistrypipeline

Azure Devops : unauthorized: authentication required,


need some help. I created a custom image that pushes to Azure Container Registry and use it as a based image for the Azure DevOps pipeline, but it seems it does not pull the image.

azure-pipelines.yml

jobs:
- job: rf
  container:
    image: test.net/rethrf:8944

Output

Error response from daemon: Head "https://test.net/v2/rethrf/manifests/8944": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.
##[warning]Docker pull failed with exit code 1, back off 2.89 seconds before retry.

any solution to this? or did I miss any environment variables?


Solution

    • you need to add a service connection since you are communicating with the other azure services.

    • you can add service connection in portal it is under the project settings. enter image description here

    enter image description here

    • Select service connection and after that popup will appear on which you have to select docker registry
      enter image description here
    • Fill the subsequent form about the subscription and ACR details enter image description here
    • Another approach would be to use docker to pull images

    Refer this documentation about it.