<p>I am trying to add my context as an <code>environment variable</code> in <code>Azure Container App</code> like below but it throws an error.</p>
<pre><code>az containerapp update -n MyContainerapp -g MyResourceGroup -v ConnectionStrings:MyContext=secretref:mycontextsecretkey
</code></pre>
<blockquote>
<p>Invalid value: &quot;ConnectionStrings:MyContext&quot;: Invalid Environment
Variable Name</p>
</blockquote>
<p>I tried with <code>ConnectionStrings__MyContext</code> but the Asp.Net Core app does not recognize it.</p>
<p>How can I add this?</p>

Ramesh
<p>This error <strong>Invalid value: &quot;ConnectionStrings:MyContext&quot;</strong>: Invalid Environment Variable Name indicates that environment variable you are trying to define is unsupported.</p>
<p>Instead of using <strong>&quot;ConnectionStrings:MyContext&quot;, use MyConnectionStrings_MyContext</strong> as your environment variable.</p>
<p>You can use the below command,</p>
<pre><code>az containerapp update -n MyContainerapp -g MyResourceGroup -v MyConnectionStrings_MyContext=secretref:mycontextsecretkey
</code></pre>
<p>Reference : <a href="https://www.mihajakovac.com/set-environment-variables-to-azure-container-app/" rel="nofollow noreferrer">Set Environment variables to Azure Container App | Miha Jakovac</a></p>
