Azure Web App for Containers not setting Environment Variables
Asked Answered
M

1

9

I have a docker image being deployed from Azure Container Registry. Everything works fine except that I expect to be able to see environment variables being passed to my running docker image from the Application Settings configured in the portal. It is a Node app accessing environment variables with process.env.VariableName.

As an example its says here https://blogs.msdn.microsoft.com/waws/2017/09/08/things-you-should-know-web-apps-and-linux/#SetEnvVar … "App Settings are injected into your app as environment variables at runtime"

I have tried the following.

  • Setting Applications Settings in the Azure Portal. These are supposed to get passed to the running Docker image as per the documentation but process.env.VariableName in my Node application is not set.

  • I have tried using a Docker compose file that sets the environment variables but again process.env.VariableName is empty.

  • I have even updated the VSTS build arguments passing the Variable to my Docker file on build which in turn sets the environment variable. Again no variable passed to the running Docker image.

My conclusion is that custom environment variables are not allowed in Azure Web App for Containers?

Am I doing something wrong?

Madelina answered 19/9, 2018 at 7:17 Comment(3)
no native support. you need to set it via CLI. #50682321Paprika
But it IS supposed to have native support. The documentation says so.Madelina
I have this same issue. This is very dissappoitingConvertible
C
1

As per the documentation the app settings are injected into the process as environment variables, however the environment variable name is prefixed with APPSETTING_, so in your Node application you would need to access the app setting with process.env.APPSETTING_VariableName.

Charissacharisse answered 15/5, 2021 at 20:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.