azure-pipelines-tasks: [REGRESSION]: Docker@2 Task suddenly stared throwing error and is giving inconsistent behavior with private ACR

New issue checklist

Task name

Docker@2

Breaking task version

2.254.1

Last working task version

2.248.1

Regression Description

Private docker task has been working without issue using Docker service connection with Workload Federation Identity but suddenly is getting error:

Can’t find loc string for key: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Linux

Relevant log output

##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [] : @azure/msal-node@2.11.1 : Info - acquireTokenByClientCredential called
##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [f7ef0913-50e4-413b-9804-cd348ca8882a] : @azure/msal-node@2.11.1 : Info - Building oauth client configuration with the following authority: https://login.microsoftonline.com/64849973-d2a6-4126-a487-d88b2c9fa3a5/oauth2/v2.0/token.
##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [f7ef0913-50e4-413b-9804-cd348ca8882a] : @azure/msal-common@14.13.1 : Info - Sending token request to endpoint: https://login.microsoftonline.com/64849973-d2a6-4126-a487-d88b2c9fa3a5/oauth2/v2.0/token
##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [f7ef0913-50e4-413b-9804-cd348ca8882a] : @azure/msal-common@14.13.1 : Warning - No client info in response
##[debug]MSAL - retrieved token - isFromCache?: false
##[debug]Attempting to convert AAD Token to an ACR token
##[debug]2916be73-f713-47b8-8614-573191e85c2e auth param tenantid = 64849973-d2a6-4126-a487-d88b2c9fa3a5
##[debug]CLIENT_RESETSTREAMONRETRY=undefined
##[debug][POST]https://***/oauth2/exchange
##[warning]Can't find loc string for key: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode
##[debug]Processed: ##vso[task.issue type=warning;source=TaskInternal;correlationId=e11c3a5b-3e6b-4414-a224-e04627ee1b36;]Can't find loc string for key: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode
##[debug]task result: Failed
##[error]Unhandled: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=e11c3a5b-3e6b-4414-a224-e04627ee1b36;]Unhandled: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
##[error]Error: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
    at process.<anonymous> (/home/plcazadmin/myagent/_work/_tasks/Docker_e28912f1-0114-4464-802a-a3a35437fd16/2.248.1/node_modules/azure-pipelines-task-lib/task.js:119:15)
    at process.emit (node:events:519:28)
    at emitUnhandledRejection (node:internal/process/promises:250:13)
    at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=e11c3a5b-3e6b-4414-a224-e04627ee1b36;]Error: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
    at process.<anonymous> (/home/plcazadmin/myagent/_work/_tasks/Docker_e28912f1-0114-4464-802a-a3a35437fd16/2.248.1/node_modules/azure-pipelines-task-lib/task.js:119:15)
    at process.emit (node:events:519:28)
    at emitUnhandledRejection (node:internal/process/promises:250:13)
    at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)

Full task logs with system.debug enabled

UNSUCCESSFUL RUN
 ##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [] : @azure/msal-node@2.11.1 : Info - acquireTokenByClientCredential called
##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [f7ef0913-50e4-413b-9804-cd348ca8882a] : @azure/msal-node@2.11.1 : Info - Building oauth client configuration with the following authority: https://login.microsoftonline.com/64849973-d2a6-4126-a487-d88b2c9fa3a5/oauth2/v2.0/token.
##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [f7ef0913-50e4-413b-9804-cd348ca8882a] : @azure/msal-common@14.13.1 : Info - Sending token request to endpoint: https://login.microsoftonline.com/64849973-d2a6-4126-a487-d88b2c9fa3a5/oauth2/v2.0/token
##[debug][Wed, 26 Mar 2025 01:22:03 GMT] : [f7ef0913-50e4-413b-9804-cd348ca8882a] : @azure/msal-common@14.13.1 : Warning - No client info in response
##[debug]MSAL - retrieved token - isFromCache?: false
##[debug]Attempting to convert AAD Token to an ACR token
##[debug]2916be73-f713-47b8-8614-573191e85c2e auth param tenantid = 64849973-d2a6-4126-a487-d88b2c9fa3a5
##[debug]CLIENT_RESETSTREAMONRETRY=undefined
##[debug][POST][https://***/oauth2/exchange](https://%2A%2A%2A/oauth2/exchange)
##[warning]Can't find loc string for key: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode
##[debug]Processed: ##vso[task.issue type=warning;source=TaskInternal;correlationId=e11c3a5b-3e6b-4414-a224-e04627ee1b36;]Can't find loc string for key: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode
##[debug]task result: Failed
##[error]Unhandled: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=e11c3a5b-3e6b-4414-a224-e04627ee1b36;]Unhandled: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
##[error]Error: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
    at process.<anonymous> (/home/plcazadmin/myagent/_work/_tasks/Docker_e28912f1-0114-4464-802a-a3a35437fd16/2.248.1/node_modules/azure-pipelines-task-lib/task.js:119:15)
    at process.emit (node:events:519:28)
    at emitUnhandledRejection (node:internal/process/promises:250:13)
    at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=e11c3a5b-3e6b-4414-a224-e04627ee1b36;]Error: CouldNotFetchAccessTokenforMSIDueToACRNotConfiguredProperlyStatusCode 403 Forbidden
    at process.<anonymous> (/home/plcazadmin/myagent/_work/_tasks/Docker_e28912f1-0114-4464-802a-a3a35437fd16/2.248.1/node_modules/azure-pipelines-task-lib/task.js:119:15)
    at process.emit (node:events:519:28)
    at emitUnhandledRejection (node:internal/process/promises:250:13)
    at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
 
SUCCESSFUL RUN
 5e349dc1980a: Layer already exists
17796ca72fd1: Layer already exists
9ab0138cf0f0: Layer already exists
dc5db99e9a6d: Layer already exists
5f70bf18a086: Layer already exists
a3287ff36a43: Layer already exists
9b11faa5119c: Layer already exists
1287fbecdfcc: Layer already exists
55aa12193cca: Layer already exists
latest: digest: sha256:7411f31e26ec1723025f58c46e9422cf19ee4f5d42570673153cbad03f800774 size: 2204

/snap/bin/docker history --format createdAt:{{.CreatedAt}}; layerSize:{{.Size}}; createdBy:{{.CreatedBy}}; layerId:{{.ID}} --no-trunc **/userserver:latest createdAt:2025-03-24T15:41:11Z; layerSize:0B; createdBy:ENTRYPOINT [“dotnet” “App.UserServer.dll”]; layerId:sha256:6427d01d21a61fe2c2537bb7d09e1e7792d653c9be538085f373c8711e1b1d7e createdAt:2025-03-24T15:41:11Z; layerSize:39.1MB; createdBy:COPY /app/publish . # buildkit; layerId:<missing> createdAt:2025-03-18T21:53:35Z; layerSize:0B; createdBy:WORKDIR /app; layerId:<missing> createdAt:2025-03-18T21:53:35Z; layerSize:0B; createdBy:EXPOSE map[443/tcp:{}]; layerId:<missing> createdAt:2025-03-18T21:53:35Z; layerSize:0B; createdBy:EXPOSE map[80/tcp:{}]; layerId:<missing> createdAt:2025-03-18T21:53:29Z; layerSize:0B; createdBy:WORKDIR /app; layerId:<missing> createdAt:2025-03-18T00:35:47Z; layerSize:24.1MB; createdBy:COPY /dotnet /usr/share/dotnet # buildkit; layerId:<missing> createdAt:2025-03-18T00:35:47Z; layerSize:0B; createdBy:ENV ASPNET_VERSION=8.0.14; layerId:<missing> createdAt:2025-03-18T00:35:42Z; layerSize:0B; createdBy:RUN /bin/sh -c ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet # buildkit; layerId:<missing> createdAt:2025-03-18T00:35:41Z; layerSize:72.4MB; createdBy:COPY /dotnet /usr/share/dotnet # buildkit; layerId:<missing> createdAt:2025-03-18T00:35:41Z; layerSize:0B; createdBy:ENV DOTNET_VERSION=8.0.14; layerId:<missing> createdAt:2025-03-18T00:35:35Z; layerSize:8.46kB; createdBy:RUN /bin/sh -c groupadd --gid=$APP_UID app && useradd -l --uid=$APP_UID --gid=$APP_UID --create-home app # buildkit; layerId:<missing> createdAt:2025-03-18T00:35:34Z; layerSize:46.2MB; createdBy:RUN /bin/sh -c apt-get update && apt-get install -y --no-install-recommends ca-certificates libc6 libgcc-s1 libicu72 libssl3 libstdc++6 tzdata zlib1g && rm -rf /var/lib/apt/lists/ # buildkit; layerId:<missing> createdAt:2025-03-18T00:35:34Z; layerSize:0B; createdBy:ENV APP_UID=1654 ASPNETCORE_HTTP_PORTS=8080 DOTNET_RUNNING_IN_CONTAINER=true; layerId:<missing> createdAt:2025-03-17T00:00:00Z; layerSize:74.8MB; createdBy:# debian.sh --arch ‘amd64’ out/ ‘bookworm’ ‘@1742169600’; layerId:<missing>

/snap/bin/docker inspect 6427d01d21a61fe2c2537bb7d09e1e7792d653c9be538085f373c8711e1b1d7e -f {{.RootFS.Layers}}

Repro steps

parameters:
  environment: ''
  azureServiceConnection: ''
  appName: ''
  agentPool: ''
  dockerRepo: ''
  dockerFile: ''
  dockerRepoServiceConnection: ''
  buildContext: ''
  
stages:  

  - stage: 'BuildContainer${{ parameters.environment }}'
    displayName: 'Build  ${{ parameters.environment }} ${{ parameters.appName }} Container'
    pool:
      name: ${{ parameters.agentPool }}
    jobs:
    - deployment: 'Build${{ parameters.environment }}'
      environment: ${{ parameters.environment }}
      timeoutInMinutes: '360'
      strategy:
       runOnce:
          deploy:
             steps:
              - checkout: self
              # Build and push container image
              - task: Docker@2
                displayName: 'Build and push ${{ parameters.appName }} container image'
                inputs:
                  command: 'buildAndPush'
                  repository: '${{ parameters.dockerRepo }}'
                  containerRegistry: '${{ parameters.dockerRepoServiceConnection }}'
                  buildContext: '${{ parameters.buildContext }}'
                  Dockerfile: '${{ parameters.dockerFile }}'
                  tags: |
                    $(Build.BuildId)
                    latest

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Why was this marked closed? We still don’t have a solution.

Yeah unfortunately in my case I’m just having a resolution issue from our self hosted agents, not my Azure Container Apps, they have no issue pulling. It’s weird that it suddenly stopped working. We have had private DNS zones, custom DNS servers, all connected to our hub network deploying privately for a month without issue. Even still when I do an nslookup from a various spoke, or from the self hosted agents in the same VNET, they are able to resolve the ACR private IP. This is a image from the agent in the same VNET.

Image

@Rembrandtastic I had the same exact issue yesterday.

  • Private AKS cluster
  • Private ACR registry
  • Agent pool running on AKS itself

I had to spinup a debug pod on K8s:

kubectl run -it --rm --restart=Never --image nicolaka/netshoot debugpod -- sh

then from it I run dig on the ACR:

dig +all ACRNAME.azurecr.io

and from it I figured out I was resolving a public IP address for the acr. We fixed the dns configuration that is now resolving to the privatelink address correctly and the issue has been resolved.