Deploy Azure Webapp with custom container environment variables Deploy Azure Webapp with custom container environment variables docker docker

Deploy Azure Webapp with custom container environment variables


I guess I found the solution for the problem:

App Settings are injected into your app as environment variables at runtime.

If you need to set an environment variable for your application, simply add an App Setting in the Azure portal. When your app runs, we will inject the app setting into the process as an environment variable automatically.

How it works via CLI:

az webapp config appsettings set --name <mycontainername> --resource-group <myresourcegroupname> --settings a='b' 

Setting all environment variables via CLI like the command above worked for me. The same is possible via the portal UI in app settings. If you check how Azure starts the Docker instance, you will see that none of the set environment variables are set during startup (like.docker run -d -p 3287:3000 --name <mycontainername -e a=b) but if you login to the Docker container and run an echo command for the environment variable, you will see that the environment variable has been injected.

Note: Maybe you have to restart the Docker instance in order to have the new environment variables injected.