Home > Mobile >  How to add indepth environment variables in Azure Container Apps
How to add indepth environment variables in Azure Container Apps

Time:03-11

I am trying to add my context as an environment variable in Azure Container App like below but it throws an error.

az containerapp update -n MyContainerapp -g MyResourceGroup -v ConnectionStrings:MyContext=secretref:mycontextsecretkey

Invalid value: "ConnectionStrings:MyContext": Invalid Environment Variable Name

I tried with ConnectionStrings__MyContext but the Asp.Net Core app does not recognize it.

How can I add this?

CodePudding user response:

This error Invalid value: "ConnectionStrings:MyContext": Invalid Environment Variable Name indicates that environment variable you are trying to define is unsupported.

Instead of using "ConnectionStrings:MyContext", use MyConnectionStrings_MyContext as your environment variable.

You can use the below command,

az containerapp update -n MyContainerapp -g MyResourceGroup -v MyConnectionStrings_MyContext=secretref:mycontextsecretkey

Reference : Set Environment variables to Azure Container App | Miha Jakovac

  • Related