microsoft / microsoft/aspire

AddAzureFunctionsProject does not apply environmentVariables from launch profile

Open
#16,206 0 comments 0 reactions 0 assignees View on GitHub
area-integrations azure-functions
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

When adding an Azure Functions project via AddAzureFunctionsProject, any environmentVariables defined in the project's launchSettings.json launch profile are silently ignored. The same variables are applied when using the standard AddProject for ASP.NET Core projects

### Expected Behavior

Environment variables defined under the active launch profile's environmentVariables section should be injected into the Functions process, matching the behaviour of AddProject.

### Steps To Reproduce

https://github.com/mrafnadeem-apimatic/aspire-functions-launchprofile-envvar-repro

### Exceptions (if any)

_No response_

### Aspire doctor output

Aspire Environment Check
========================

.NET SDK
✔ .NET 11.0.100-preview.2.26159.112 installed (x64)

Container Runtime
✔ Docker Desktop detected and running (version 29.1.3)

Environment
✔ HTTPS development certificate is trusted

Summary: 3 passed, 0 warnings, 0 failed

### Anything else?

My workaround was to load the launchSettings.json file, and load environment variables using `.WithEnvironment("MY_SETTING", "local-value")` directly in the AppHost.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.