Continuous deployment with Azure Web App for Containers

In this tutorial, you configure continuous deployment for a custom container image from Managed Azure Container Registry repositories or Docker Hub.

Step 1 - Sign in to Azure

Sign in to the Azure portal at http://portal.azure.com

Step 2 - Enable container continuous deployment feature

You can enable the continuous deployment feature using Azure CLI and executing the following command

az webapp deployment container config -n sname -g rgname -e true

In the Azure portal, click the App Service option on the left of the page.

Click on the name of your app that you want to configure Docker Hub continuous deployment for.

In the App settings, add an app setting called DOCKER_ENABLE_CI with the value true.

insert image of app setting

Step 3 - Prepare Webhook URL

You can obtain the Webhook URL using Azure CLI and executing the following command

az webapp deployment container show-cd-url -n sname1 -g rgname

For the Webhook URL, you need to have the following endpoint: https://<publishingusername>:<publishingpwd>@<sitename>.scm.azurewebsites.net/docker/hook.

You can obtain your publishingusername and publishingpwd by downloading the web app publish profile using the Azure portal.

insert image of adding webhook 2

Step 4 - Add a web hook

Azure Container Registry

In your registry portal blade, click Webhooks, create a new webhook by clicking Add. In the Create webhook blade, give your webhook a name. For the Webhook URI, you need to provide the URL obtained from Step 3

Make sure that you define the scope as the repo that contains your container image.

insert image of webhook

When the image gets updated, the web app get updated automatically with the new image.

Docker Hub

In your Docker Hub page, click Webhooks, then CREATE A WEBHOOK.

insert image of adding webhook 1

For the Webhook URL, you need to provide the URL obtained from Step 3

insert image of adding webhook 2

When the image gets updated, the web app get updated automatically with the new image.

Next steps