Environment variables in an Azure Web App for Containers

Here's a little gotcha I ran into. A .net core app I wrote needs to run inside a container and the target was a Web App for Containers on the Azure platform. No big deal so far.

The app also needs a few settings for it to do its work. We provide these via environment variables for maximum flexibility. After setting up some CI/CD stuff and deploying the app it wouldn't start because it wasn't loading the settings.

But why?? The spec is pretty clear on how to write the keys for the settings in such a way that .net understands them.

Settings

So the secret sauce to this problem is replacing : in the settings for your app with __ (that's 2 underscores). I managed to get to this by messing around (there were some other settings with just 1 _ as well ...) and I wasn't able to find an official source for this.

It probably has something to do with passing stuff on the command-line that launches the container and the arguments containing :-characters, I have no idea. Using __ is what works right now 🙂

The original article was posted on: www.harrewijnen.net

Related articles

  • Digital Workspace
  • Cloud Infrastructure
  • Application Modernization
  • ITTS (IT Transformation Services)
  • Managed Security Operations
  • Multi-Cloud Platform
  • Backup & Disaster Recovery
Visit our knowledge hub
Visit our knowledge hub
Sander Harrewijnen Developer

Let's talk!

Knowledge is key for our existence. This knowledge we use for disruptive innovation and changing organizations. Are you ready for change?

Your first name*
Your last name*