Azure WebApps for Containers and AppSettings/Environment Variables
Asked Answered
C

1

5

I have a web app for containers running linux. Im running a docker container. It all works but I wanted to add an environment variable as follows:

docker run -e my_app_setting_var=theValue

The documentation says that app setting will be automatically added as -e environment variables here: App Settings are injected into your app as environment variables at runtime

But as you can see from my logs it doesnt get added: (some stuff stripped out)

docker run -d -p 30174:5000 --name thename -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=5000 -e WEBSITE_SITE_NAME=the_website_name -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=the_role_id -e HTTP_LOGGING_ENABLED=1 acr_where_image_is.azurecr.io/image_name:latest Dockerfile

I would expect to see an environment variable like this:

docker run -d -p 30174:5000 --name thename -e my_app_setting_var=theValue

Any ideas?

Cheers

Crescen answered 28/11, 2018 at 23:46 Comment(0)
J
8

The Azure Web App for Container will inject the environment variables that you set in the portal or through the Azure CLI. But unfortunately, you will not see your environment variables in the logs. The logs will show you a little of the variables. You can just confirm with echo the variables in the tool just like Kudu, and you can see them in the environment.

enter image description here enter image description here enter image description here

Joplin answered 29/11, 2018 at 1:54 Comment(1)
thanks for this. I just tried it and it works. I now know the issue. Cheers RussCrescen

© 2022 - 2024 — McMap. All rights reserved.