Exploring Container Sidecars on App Service Plans

I previously looked at the Docker Compose with app service plan preview feature, however I recently received an email that this is going away in favour of sidecar containers. With this announcement I thought that in this post I would take a look at sidecar containers and how to use them, covering some of the questions it raises.
Docker Compose public preview feature for Azure App Service will be retired on 31 March 2027 - Replace with sidecar container in Azure App Service
Sidecars
The sidecar pattern allows you to run additional containers alongside your main application container. Sidecars are common in Kubernetes but are also generally available in Azure App Service plans for Linux, allowing adding up to nine sidecar containers to a web app.
These sidecars can add functionality, such as automatic logging, monitoring, or caching often without changing any application code. Unlike the main app in the app service plan these are all private, accessed only by your application. The sidecar container runs in the same environment as the main application container with the app connecting via localhost, allowing them to communicate with each other easily and efficiently.
Sidecars for Linux app service plans were announced all the way back at Microsoft Ignite 2023 and in November last year became Generally Available.
Docker Compose
Docker compose allows us to run multiple containers together, specifying the relationships, networking, storage ect. This is great for local development but not ideal for production, and many compose features did not make sense when working with app service plans. During the preview the Azure Portal also did not support the compose features.
The sidecar pattern better describes how we want to run containers alongside our main application container and better aligns with the kubernetes terminology. The Azure Portal user interface has also been updated to better reflect this, allowing you to add sidecars to your web app.
Azure Portal Support
To use sidecars feature you need to be using a Linux App Service Plan with the setting Enhanced configuration with sidecar support
set to true.
Once enabled this updates the Deployment Centre
page on the web app to show any sidecars you have configured and also allows you to add more.
The Enhanced configuration with sidecar support
option only seems to be available when creating a new app service plan.
If you have an existing app service plan the documentation suggest you would be prompted to try the new experience when you go to the Deployment Centre
page. However I did not see this prompt when I tried it on an existing app service plan. I did have some success on an existing plan if I added the sidecar using Bicep or an ARM template.
This then enabled the new page layout but only with the option to add Custom Containers
. I would assume that in time this will be available for existing app service plans.
What Sidecars can be Used
There are two options when adding a sidecar container. You can either use a custom container or a side car extension. The extensions are a pre-defined list of containers that are available to use as sidecars. At the moment the list is limited to just AI, Redis and DataDog.
You can however add your own custom container as a sidecar, which is probably a more common use case.
This can also be done using Bicep or ARM templates.
Code Based Apps
If we use code deploy rather than our own custom container, under a Linux App service plan our code is automatically wrapped in a container before it is run. This means in theory we would be able to use a sidecar container with our code based app, however this is not yet supported. It was mentioned in a recent Azure Friday video this feature is coming soon.
Windows Containers
The support for windows containers is not as complete as it is for Linux containers in App service plans, however there are fewer use cases for Windows containers.
Like with the docker compose preview feature, the sidecar pattern is not supported on Windows App Service plans. Azure container apps (ACA) do not support window containers so your only option is to use AKS if you need Windows containers along with sidecars.
Learn More
This post is a quick overview, there are many more details to learn about sidecars. Here are some links to get you started:
Side Car Deep Dive - Azure App Service Azure Friday Extend Azure App Service with Sidecars MS Learn - Tutorial: Configure a sidecar container for a Linux app in Azure App Service MS Learn - Tutorial: Configure a sidecar container for custom container in Azure App Service
Conclusion
Container sidecars are a great way to extend the functionality of your app service plan often without changing any code. They allow you to run additional containers alongside your main application, providing a flexible and powerful way to enhance your applications.