Azure Dev Ops (ADO) will typically make your pipeline variables, or linked groups of pipeline variables from its library, available as appsettings, but that means different things in different stacks.
To utilize those ADO-defined pipeline variables as a System.Environment.EnvironmentVariable as C#/dotnet uses them (and which may be required for a library or framework you're using), there is an extra step.
Within the options for the deploy task "Deploy Azure Function App" in ADO, there is a section called "Application and Configuration Settings", and within that expandable section a text box for "App settings." Here you can define what would be injected as System.Environment.EnvironmentVariables, and give them a value that refers to the pipeline variables you set in ADO.
The syntax is -FUNCTION_APP_ENVIRONMENT_VARIABLE_NAME $(PipelineOrGroupVariableName). Where the text after the dash is the eventual name of the enviro variable within your dotnet application, followed by a space, and the value. To have the value refer to the value of our ADO pipeline variable, you place the pipeline variable name between the parentheses in $().
Multiple variables are fine, just use a space to separate, and never use a newline. If your pipeline variable's value has a space in it, you must use double quotes around the reference to it, like so: "$(PipelineVariableName)"
In OP's case, -AppName $(AppName) in that text box would allow them to retrieve their value as an environment variable at runtime with var appName = System.Environment.GetEnvironmentVariable("AppName");
