microsoft / microsoft/aspire

Aspire not sending args to Azure Functions

Open
#18,686 2 comments 0 reactions 0 assignees View on GitHub
area-integrations
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

Using `.WithArgs(...)` in the Aspire host when building the Azure Functions doesn't pass the arguments to the function:

```
// Aspire
builder.AddAzureFunctionsProject("my-function")
.WithArgs("--test", "true");
...

// Function
var builder = FunctionsApplication.CreateBuilder(args);
if (!args.Contains("--test"))
{
throw new System.Exception("Missing required argument: --test");
}
...
```

### Expected Behavior

Function should get the custom arguments

### Steps To Reproduce

This [repo](https://github.com/darianferrer/AspireFunction) can be used to reproduce the bug. It throws an exception if the argument passed in Aspire is not present.

### Exceptions (if any)

_No response_

### Aspire doctor output

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

.NET SDK
✅ .NET 10.0.301 installed (x64)

Container Runtime
✅ Docker: running (auto-detected (default)) ← active

Environment
✅ HTTPS development certificate is trusted

Summary: 3 passed, 0 warnings, 0 failed

### Anything else?

This is the output when running the above repo

Image

Contributor guide

Open the contributing guide

Research direction

Run the linked AspireFunction reproduction and start at AddAzureFunctionsProject(...).WithArgs(...), following the arguments to the FunctionsApplication.CreateBuilder(args) entry point. Done means the function receives --test and true and no longer throws the missing-argument exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.