# Unable to set username password for Elastic in azure container app

**URL:** <https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962>\
**Category:** Elasticsearch\
**Created:** [February 24, 2025, 7:47pm UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962 "2025-02-24T19:47:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chand\_techie](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@chand\_techie](https://discuss.elastic.co/u/chand_techie)\
**Post date:** [February 24, 2025, 7:47pm UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/1 "2025-02-24T19:47:43Z")

</div>

Unable to set username password for Elastic in conatiner app. As to launch the container app, I am passing below environment varibles.

xpack.security.enabled = false  
discovery.type = single-node

If I make xpack.security.enabled = true to set the username password, then the app is failing to launch with below msg:  
upstream connect error or disconnect/reset before headers. retried and the latest reset reason : connection termination.  
Sometimes it is showing 502 error.

---

<div class="post-metadata">

**Author:** ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)\
**Post date:** [February 24, 2025, 8:49pm UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/2 "2025-02-24T20:49:48Z")

</div>

Thanks, @chand_techie. Do you have the text of the error message you receive when you get the 502 error?

---

<div class="post-metadata">

**Author:** ![JinnaBalu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jinnabalu/32/27899_2.png) [@JinnaBalu](https://discuss.elastic.co/u/JinnaBalu)\
**Post date:** [February 25, 2025, 6:29am UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/3 "2025-02-25T06:29:24Z")

</div>

Try with new volume for security, it should work.

This issue possible when you are running the single node with `xpack.security.enabled = false` , elasticsearch will doesn't create security indices. If you are trying to restart with enable true with existing data it will cause the issue.

If you need current data, create a snapshot of the current indices and with new data volume run the container again.

---

<div class="post-metadata">

**Author:** ![chand\_techie](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@chand\_techie](https://discuss.elastic.co/u/chand_techie)\
**Post date:** [February 25, 2025, 8:33am UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/4 "2025-02-25T08:33:29Z")

</div>

Hi Jessgarson,

Only 1 time so far i got the 502 error, I have tried to replicate the scenario where pass the xpac.security.enabled = true. Getting below msg on the browser while launching the elastic:  
upstream connect error or disconnect/reset before headers. retried and the latest reset reason: connection termination

---

<div class="post-metadata">

**Author:** ![chand\_techie](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@chand\_techie](https://discuss.elastic.co/u/chand_techie)\
**Post date:** [February 25, 2025, 8:37am UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/5 "2025-02-25T08:37:04Z")

</div>

@JinnaBalu --- even If I dnt attach any volume in my container app, just to check if the elastic gets launched or not .. its not working. I have tried passing with xpac.security.enabled as true and container showing running status but on browser, I am not getting below msg : upstream connect error or disconnect/reset before headers. retried and the latest reset reason: connection termination.

---

<div class="post-metadata">

**Author:** ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)\
**Post date:** [February 26, 2025, 3:22pm UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/6 "2025-02-26T15:22:02Z")

</div>

Thanks for following up, @chand_techie. You may want to try double checking your logs, as well as checking your resource contstraints too.

Here are a few resources that may be helpful here, too:

- [Security settings in Elasticsearch | Elasticsearch Guide [8.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html)
- [Troubleshooting security | Elasticsearch Guide [8.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-troubleshooting.html)

---

<div class="post-metadata">

**Author:** ![chand\_techie](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@chand\_techie](https://discuss.elastic.co/u/chand_techie)\
**Post date:** [February 27, 2025, 6:31pm UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/7 "2025-02-27T18:31:49Z")

</div>

@jessgarson, thanks for the reply. I had a working Elastic setup with username and password which is working perfectly fine in a IAAS VM in Azure.

Looking here for a solution where we are hosting elastic on Container app (PAAS) in Azure. I have followed the below document link, where it is mentioned to Elastic on container app we need to pass xpac.security.enabled=false, if I set up this as true my elastic app doesn't launch.  
Doc link: {azureossd\_github\_io/2024/08/13/Setting-up-a-basic-Elasticsearch-container-on-Container-Apps/} (Kindly replace \_ with dot as the forum is not allowing me to post a link)

How we can setup the username password with Elastic hosting on container app. Could you please help me in this regard.

---

<div class="post-metadata">

**Author:** ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)\
**Post date:** [February 28, 2025, 7:27pm UTC](https://discuss.elastic.co/t/unable-to-set-username-password-for-elastic-in-azure-container-app/374962/8 "2025-02-28T19:27:39Z")

</div>

Thanks. Can you say a bit more about you are passing in your username and password? I saw this related [stack overflow post](https://stackoverflow.com/questions/71269878/elasticsearch-installation-asking-for-username-and-password) that suggests trying:

```auto
elasticsearch-reset-password -u elastic --interactive

```
