.net - How to get the sasl.username & sasl.password in Dockerized ,net core application - Stack Overflow

admin2025-04-17  4

i have a core application that uses event hub to consume & produce messages. it uses azure event hub & i configured sasl.username as "$ConnectionString" & sasl.password as "Endpoint=sb://xxxxxxxxxxxxxxxxx" in the appsettings.json & deployed to azure app service. This works successfully. But when i dockerized core application deploy via a docker-compose.yml, (define the variables in docker-compose.yml environment section) with the same variables it says sasl.username & sasl.password needs to be set. i have tried various things even from chatgpt to get a correct method. But i couldn't. Also when i log in to the container the Kafkachannel__SaslUsername= is empty. Higly appreciated if some one can help me on this. i have spent about 24 hours to fix this without any success.

i have a .net core application that uses event hub to consume & produce messages. it uses azure event hub & i configured sasl.username as "$ConnectionString" & sasl.password as "Endpoint=sb://xxxxxxxxxxxxxxxxx" in the appsettings.json & deployed to azure app service. This works successfully. But when i dockerized .net core application deploy via a docker-compose.yml, (define the variables in docker-compose.yml environment section) with the same variables it says sasl.username & sasl.password needs to be set. i have tried various things even from chatgpt to get a correct method. But i couldn't. Also when i log in to the container the Kafkachannel__SaslUsername= is empty. Higly appreciated if some one can help me on this. i have spent about 24 hours to fix this without any success.

Share Improve this question edited Jan 31 at 17:35 Jesse Squire 8,0351 gold badge30 silver badges33 bronze badges asked Jan 31 at 13:18 Prageeth AthulathmudaliPrageeth Athulathmudali 872 silver badges7 bronze badges 2
  • when i go inside the container - KafkaChannel__SaslUsername=' ' is empty. This is a Linux container. – Prageeth Athulathmudali Commented Feb 1 at 8:49
  • when i go inside the container - KafkaChannel__SaslUsername=' ' is empty. This is a Linux container. tried following options. 1. KafkaChannel__SaslUsername='\$ConnectionString' 2. KafkaChannel__SaslUsername='$ConnectionString' 3. KafkaChannel__SaslUsername="\$ConnectionString" – Prageeth Athulathmudali Commented Feb 1 at 8:56
Add a comment  | 

1 Answer 1

Reset to default 0

As mentioned when i log in to the container KafkaChannel__SaslUsername is empty. in order to fix the we need use double $$ syntax like this inside the docker-compose.yml. KafkaChannel__SaslUsername=$$ConnectionString

转载请注明原文地址:http://anycun.com/QandA/1744860193a88638.html