Adventures with Bicep: How to Create an App Service for Containers

I wanted to create the following Azure resources:

  • Azure Container Registry
  • App Service Plan
  • App Service

The App Service would need to support Linux containers.

I have been doing a lot with Bicep, with the following bicep file as my first attempt:

When I ran my script the first time, it wasn’t setup for containers, and I couldn’t figure out why.

Finally, I compared it to an existing App Service that supported containers and noticed I had not provided a value for the linuxFxVersion property in the siteConfig for the App Service.

If this was the first time I was running the script, I would not have a value.

What could I use then?

All I needed to do was set it to DOCKER|nginx.

So for the siteConfig I added linuxFxVersion: 'DOCKER|nginx'.

That did the trick!

Now this begs the question, how would I make this idempotent?

What if a specific container image was deployed?

I will have to explore this further, but I am thinking I will have to pass in a value to the template.

Will keep you posted on how that turns out!


Discover more from Matt Ruma

Subscribe to get the latest posts sent to your email.

Leave a Reply

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