Selling Container Pictures To Manufacturing Utilizing Azure DevOps

Containers make our lives easy with “Construct As soon as Deploy Anyplace“.


It is to construct photos and run them on native or dev-test environments, however let’s have a look at how you can take them on the total cycle of making the photographs, selling them as an artifact from dev to manufacturing utilizing Azure DevOps. 



  •  Learn how to carry the artifact (container picture) throughout environments with out rebuilding the picture once more for every atmosphere.
  •  Not all of the dev photos qualify for manufacturing so we can not push the picture to all of the atmosphere registries on the event stage.
  •  Rollback operations on any manufacturing launch failures.

Right here is among the finest practices.


I might be following for selling the photographs from dev to larger atmosphere through the use of environment-specific container registries,



How can we obtain this through the use of Azure DevOps Pipelines and Azure Container Registry?

Allow us to construct a picture first utilizing the Azure DevOps Pipeline.


Construct an Picture utilizing Azure DevOps Pipeline CI,

  1. steps:    
  2. – process: Docker@0    
  3. displayName: ‘Construct an picture’    
  4. inputs:    
  5. azureSubscription: ‘Azure’    
  6. azureContainerRegistry: ‘{“loginServer”:””, “id” : “/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/suppliers/Microsoft.ContainerRegistry/registries/containersacr”}’    
  7. dockerFile: DockerSample/DockerSample/Dockerfile    

Push the Picture to Azure Container Registry utilizing Azure DevOps Pipeline CI,

  1. steps:    
  2. – process: Docker@0    
  3. displayName: ‘Push an picture’    
  4. inputs:    
  5. azureSubscription: ‘Azure’    
  6. azureContainerRegistry: ‘{“loginServer”:“”“id” : “/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/suppliers/Microsoft.ContainerRegistry/registries/containersacr”}    
  7. motion: ‘Push an picture’    



Service connection to your Azure Container Registry and Azure Subscription is required


Promote an Picture to completely different atmosphere ACR’s


Utilizing Azure CLI we will carry out this transfer right here is the inline script, you should utilize a script file additionally.

  1. az acr import     
  2. –name myregistry     
  3. –source aci-helloworld:newest     
  4. –image aci-helloworld:newest     
  5. –registry /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/suppliers/Microsoft.ContainerRegistry/registries/mysourceregistry    


On the above-mentioned pattern, the supply and vacation spot subscription are underneath the identical Azure Tenant.


Extra samples about working with exterior registries and a number of tenant azure subscriptions can be found right here.


Promote the Picture from one registry to a different utilizing Azure DevOps Launch Pipeline


This step on Azure DevOps Launch Pipeline would transfer your picture from the supply registry to the vacation spot registry.


Right here is the total step YAML, 

  1. steps:    
  2. – process: AzureCLI@2    
  3. displayName: ‘Azure CLI ‘    
  4. inputs:     
  5.  azureSubscription: ‘Azure’     
  6.  scriptType: batch    
  7.  scriptLocation: inlineScript    
  8.  inlineScript: |    
  9.    az acr import     
  10.    –name myregistry    
  11.    –source aci-helloworld:newest      
  12.    –image aci-helloworld:newest     
  13.    –registry /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/suppliers/Microsoft.ContainerRegistry/registries/mysourceregistry    


Service Connection(Azure Subscription) used right here needs to be of the vacation spot registry.


Promoting Container Images to Production using Azure DevOps*I4UY_SG0cIhii25r_MSj7w.png


As soon as the Promote Picture step is added the following steps are of deployments of your selection, I’ve chosen the app service for container deployment.


What occurred to the Challenges?


These steps talked about above would clear up the challenges talked about to a better lengthen,

  • Construct Picture as soon as utilizing the CI
  • Promote solely the certified photos to larger environments
  • Rollback to the final construct picture immediately with the earlier launch in Azure DevOps

Moreover on App Service for Container helps Slot swapping which ensures draining of connections earlier than swapping, this may be achieved by merely deploying to the manufacturing  slot slightly than the manufacturing  app service itself.

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button