azureazure-devopsazure-container-registryserviceconnection

How can I push an image to an Azure Container Registry on a different account than the ADO Pipeline


On My ADO account, I have created a service account of Azure Resource Manager but it doesn't work with this task.

The pipeline is not valid. Job Build: Step Docker2 input containerRegistry expects a service connection of type dockerregistry but the provided service connection MyAZConnection is of type azurerm.

If I create a new Docker Registry Service Connection, it only connects to a subscription within the same Microsoft account.

Is there some alternate way to push this image to ACR in different azure account ?


Solution

  • By default, Docker@2 only supports the dockerregistry type service connection.

    Based on your requirement, you need to use the Azure Resource Manager Service Connection to deploy to different account. You can create a Manual type of Azure Resource Manager Service Connection.

    You can change to use the Docker@1 or Docker@0 Task to use the Azure Resource Manager Service Connection.

    For example:

    steps:
    - task: Docker@1
      displayName: 'Push an image'
      inputs:
        azureSubscriptionEndpoint: AzureRMServiceconnection
        azureContainerRegistry: containername
        command: 'Push an image'
    

    For more detailed info, you can refer to this doc: Docker V1