Jump to content

Best practise for Private Endpoint Enabled Docker container App Service

Featured Replies

Posted

Web App for Containers is a lightweighted way to manage app by docker image. CD (Continuous Deployment) is a common way to pull the updated docker image from docker registry (such as Azure Continer Registray or Docker Hub etc) to App Service automatically.

882x245vv2.png.a4354c743904d9283595d26fd8ae83f7.png

 

While if App Service enables Private Endpoint, the webhook from container registry should be blocked with 403 since the public access to the App Service kudu site (advanced tool site) is blocked by default. And when webhook event is trying sent to app service via Private Endpoint, it should fail with IP forbidden.

largevv2px999.png.eb7012edf7ed492f9c82ae55475483de.png

 

With the situation, this blog provide a workaround by allowing webhook IP to access App Service kudu site via public access and keep the remaining traffic go through Private Endpoint. So the diagram as below:

683x457vv2.png.025543ffef7a5790e80016380979f6ba.png

 

In order to implement the workaround, firstly we need to get the webhook IP and then whitelist IT in App Service inbound traffic. Below is the illustration for the two steps with more detail. For the docker registry, we use Azure Container Registry (ACR) as example.

 

Step 1: find the webhook IP which is blocked by App Service Private Endpoint

Once the continuous deployment is enabled for App Service, a webhook will be created automatically in the source ACR.

840x288vv2.png.307cdd22f5771e65c68b7dc9fb45e651.png

 

For ACR webhook, if it's blocked by App Service Private Endpoint, we can check the forbidden IP from the response header (x-ms-forbidden-ip). And based on my test, the ip which sending webhook is stable. So we just need to add one ip address in the following step.

828x350vv2.png.909a19491b9d4ba6607e108547d79f06.png

 

Step 2: only allow the webhook IP to access the App Service kudu site via public access

In App Service -> Networking -> Access Restrictions -> Allow public access.

 

  • For the main site, deny unmatched action and it's unnecessary to add rule for main site. That means public access is not allowed for the main site. largevv2px999.png.cfcde935bb926a3eeab006dacc5c517b.png

 

  • For Advanced tool site (kudu site), excepting the same configurations with the main site, we need to add a rule to allow the webhook IP which get from step 1.

 

890x590vv2.png.dbd503e17f3ec9e24a77ad7714f8064a.png

 

 

 

Now, Continuous Deployment should work as expected, and the webhook event can send to App Service kudu site with success.

915x238vv2.png.2d947e81ce07811f4bf2f0d1f5c0c860.png

 

Notes:

  • Since the Continuous Deployment is using basic auth, please make sure the Basic Auth for App Service is enabled832x460vv2.png.313d4e67e1c1167c4268aaddcad63563.png

 

 

  • For using Docker hub as docker registry, since the forbidden IP from webhook is not showed in Docker hub, users can contact Azure App Service support to get the forbidden IP(s) from server side.

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...