Environment Variables in .NET

noun

say it: “en-VY-run-ment VAIR-ee-uh-bulz” /ɪnˈvaɪrənmənt ˈvɛriəbəlz/

Settings given to a .NET app by the system it runs on, with __ standing for each : in a setting's name.

What is Environment Variables in .NET?

Configuration keys can be set with environment variables; a double underscore replaces the colon: ConnectionStrings__Recipes sets ConnectionStrings:Recipes. Azure App Service settings arrive this way.

$env:ConnectionStrings__Recipes = "Server=localhost;Database=Recipes;..."
dotnet run

In a sentence

  • “In Azure, the connection string comes from an environment variable, ConnectionStrings__Northwind.”

Level: Journeyman · More ASP.NET Core terms at this level

Updated