Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull and Push Docker Image task to ACR fails in Azure Devops Pipeline "unauthorized: Invalid clientid or client secret."

Pushing and pulling of image to Azure Container Registry task in Azure DevOps pipeline fails. When tried to pull or push from local system, there's no problem but when tried to do it using the Azure Devops pipeline it fails. Docker login was successful but it fails when I want to pull the image from the ACR with the following result:

**Error response from daemon: Head "***/a2/abcd/manifest/latest": unauthorized: Invalid clientid or client secret. 

##[error]Bash exited with code '1'.
##[debug]Processed: ##vso[task.issue type=error;]Bash exited with code '1'. 

I checked all the service connections in Az Devops, and they all look correctly configured. Checked the associated service principals as well if they have AcrPull and AcrPush permissions, all of them are in place. Just couldn't understand what's going wrong.

My Yaml looks like this:

trigger: none
schedules:
- cron: "0 0 0 * *"
  displayName: ****  *
  branches:
    include:
    - abcd
  always: true

pool:
  vmImage: 'ubuntu-latest'

variables:
- name: acrname
  value: *****.azurecr.io


stages:
- stage: abcd
  displayName: "pull images from acr"
  jobs:
  - job: abcdef
    displayName: "abcdef"
    pool:
      vmImage: ubuntu-latest
    steps:
      - task: Docker@2
        displayName: Login to ACR
        inputs:
          command: login
          containerRegistry: '*****.azurecr.io'
          

      - bash: |
            docker pull $(acrname)/abc-def:latest
            docker pull $(acrname)/igh-jkl:latest
        name: pull
        displayName: 'pull acr images'

Can anyone help?

like image 853
Neoneuron Avatar asked Dec 06 '25 06:12

Neoneuron


2 Answers

An alternative to creating a new service connection is instead to edit and then re-save the existing service connection. This worked for me on multiple occasions.

You may also need to reauthorize the pipeline by pressing the button that appears when you attempt to run the pipeline for the first time after re-saving the service connection.

like image 100
Vince Horst Avatar answered Dec 07 '25 20:12

Vince Horst


  1. I had the same issue with the ACR service connection was expired. So I had to create a new service connection by using these steps.

enter image description here

  1. Docker ID and Docker Password can be obtained from ACR --> Settings --> Access keys

enter image description here

  1. Update your pipeline with this new service connection and you are good to go. Please rate if this solution helps you.
like image 27
iamattiq1991 Avatar answered Dec 07 '25 21:12

iamattiq1991



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!