Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure WebApps for Containers and AppSettings/Environment Variables

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

like image 203
RuSs Avatar asked Mar 05 '23 23:03

RuSs


1 Answers

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

like image 165
Charles Xu Avatar answered Apr 08 '23 19:04

Charles Xu