Pull docker image and upload to Azure App Service programmatically - azure

We have a requirement, where we publish a docker image, and a client through an automation workflow tool such as Logic App pull down a docker image and upload it to an Azure App Service instance. Is #2, #3 achievable via some from of RESTFul API?
We publish an image into docker hub
Client runs a process to
pull this image down via HTTP request
And upload it to an
instance of an Azure app service via HTTP Request
I found this : https://docs.docker.com/registry/spec/api/#pulling-an-image just unsure if this is useful in the sense where we need to deploy this image to an Azure App Service instance and let it run the image?

You don't download an image from a container registry and upload it to App Service, you need to update the App Service configuration and App Service will pull the image. You can do this using the Azure CLI:
az webapp config container set --docker-custom-image-name org/hello-app:1.0 --name demoforharry --resource-group demo
Documentation
If you want to use HTTP, I guess that you can also use the Azure Management API.
Documentation

Related

Azure app service not pulling latest image from docker registry

I have a pipeline that publishes to my private Azure container registry but if I push a new image tagged with latest, my Azure app service does not pull the newly tagged latest image. I have Continuous deployment turned on via the DOCKER_ENABLE_CI app setting.
Additionally, I'm using a managed identity to authenticate with the ACR. I feel like the CD portion was working when I was using credentials to pull the image but after switching to managed identity it appears to have stopped. In order to get the new image I have to restart the app service which is not idea and makes this CD option useless...
When you enable Continuous deployment, App Service adds a webhook to your ACR to notify the web apps. The webhook causes your App Service app to restart and run the docker pull to get the updated image.
So, please go to your ACR, and under webhook, please check if there are running webhooks or not, if not you can create a webhook manually and see if the WebApp get the latest image in the following deployment.
source

Is it possible to migrate my Azure app service to a self hosted server via a docker image?

When I google this every result is a microsoft document describing how to bring code INTO Azure. But I am looking for a way to take an existing Azure app service and make a docker image of it and then deploy that onto my own server.
Is this possible?
I believe Azure provides a mechanism to generate the docker image. Is that all I need?

Create a pipeline on azure devops to deploy a docker container on azure app service?

I have a docker image in my Azure Container Registry and a Web App For Containers(Linux). Now, I want to create a release pipeline which should be able to deploy that container for Azure Container Registry to Web App For Container. I know I can do this manually but I need to Automate this process through Azure DevOps.
I was trying to make a release pipeline to deploy docker image on Azure web app for container and I made that pipeline by following this tutorial.
https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-docker-webapp?view=azdevops&viewFallbackFrom=vsts
I hope this can help others as well. Thank you

Azure Web App for containers CI with Azure Container Registry

I'm having an issue with Azure Container Registry CI with my Azure Web App for Containers. It seems that the web hook between them has broken.
I've tried turning the CI within the Docker settings on the Web App however this fails and also tried creating a web hook from the Azure Container Registry however it says my container registry isn't managed but doesn't give me the option to upgrade it to one.
Webhooks are not available in the classic SKU and you need to migrate for this. For CI you need to enable a webhook with the publishing creds which can call into the App service scm endpoint which can restart and repull.

Azure app service - docker container - take latest build after CI/CD

Through VSTS we have created CI/CD pipeline for a project, in which the end product is a docker image, which will be placed in a azure container registry.
In the azure app service, we have a linux container based service plan, which hosts the above placed latest image.
However, in the docker container, although we have enabled continuous deployment, the latest version is not taken, it is hosting the same older version of image.
How to deploy the latest docker image in app service container ?
Azure Container Registry webhooks can be used to automatically update your application running on Azure App Services that run your container applications.
Setup your image to deploy to your Azure Web App on Linux as per the instruction at https://learn.microsoft.com/en-us/azure/app-service-web/app-service-linux-using-custom-docker-image#how-to-use-a-docker-image-from-a-private-image-registry
In the App Settings section of your Web Application, add an app setting called DOCKER_ENABLE_CI with the value true.
Create a web hook in your registry and provide the docker callback uri which is of the form https://:#.scm.azurewebsites.net/docker/hook
https://:#.scm.azurewebsites.net/docker/hook
E.g. https://github.com/sajayantony/appservicedemo

Resources