microsoft / microsoft/aspire

RunAsFoundryLocal fails on Foundry CLI 0.10+: still calls foundry service (renamed to foundry server)

Open
#20,189 2 comments 0 reactions 0 assignees View on GitHub
area-integrations triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Description

`AddFoundry(...).RunAsFoundryLocal()` fails immediately on Foundry Local CLI **0.10.x** because the hosting integration still invokes **`foundry service`**, which was removed in the CLI 0.10 rewrite.

The Foundry resource goes to **FailedToStart**. Any deployment (`AddDeployment`) never starts. Resources that `WaitFor` that deployment stay **Waiting** (kernel/app deadlock).

## Repro

1. Install Foundry Local CLI **0.10.3** (`foundry --version` → `0.10.3`). Confirm:

```
foundry --help
```

Command groups include `server`, not `service`.

2. AppHost:

```csharp
var foundry = builder.AddFoundry("foundry").RunAsFoundryLocal();
var whisper = foundry.AddDeployment("whisper-large-v3-turbo", "whisper-large-v3-turbo", "1", "OpenAI");
builder.AddProject("app").WaitFor(whisper);
```

3. `aspire start` (or F5).

## Actual

Foundry resource console:

```
error: Unknown command: 'service'
Hint: Did you mean 'server'? Run 'foundry --help' to see available commands.
Foundry Local could not be started. Ensure it's installed correctly: https://learn.microsoft.com/azure/ai-foundry/foundry-local/get-started (Error: Foundry CLI service exited before reporting an endpoint. Exit code: 2.).
```

## Expected

`RunAsFoundryLocal` should start the daemon with the current CLI:

| Old CLI (≤0.8) | CLI 0.10+ |
| --- | --- |
| `foundry service start/stop/restart` | `foundry server start/stop/restart` |

Documented in:
- https://github.com/microsoft/foundry-local/releases/tag/cli-preview-0.10.0
- https://github.com/microsoft/foundry-local/releases/tag/cli-preview-0.10.3

Aspire docs still say `foundry service start`:
https://aspire.dev/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host/

## Environment

- Aspire CLI: **13.5.3**
- `Aspire.Hosting.Foundry`: **13.5.3-preview.1.26425.3**
- Foundry Local CLI: **0.10.3** (`foundry server`, `foundry transcribe`, no `foundry service`)
- OS: Windows 11 x64
- AppHost: .NET 11 / Aspire 13.5.3

## Related

- Aspire https://github.com/dotnet/aspire/issues/12750 — `WaitFor` hangs if Foundry Local never becomes Running (same cascade once this start fails).
- Foundry https://github.com/microsoft/foundry-local/issues/458 — CLI still does not run **voice** models (Whisper is SDK-only). Separate from this command rename; `AddDeployment(whisper-*)` would still be the wrong path even after `service` → `server`.

## Suggested fix

Detect CLI version / help output and call `foundry server start` on 0.10+, keep `foundry service start` as fallback for older CLIs. Update hosting docs to match CLI 0.10.

Contributor guide

Open the contributing guide

Research direction

Start at AddFoundry(...).RunAsFoundryLocal and reproduce with Foundry Local CLI 0.10.3 using foundry --help and aspire start. Verify the daemon command for current and older CLI versions, then update the Azure AI Foundry hosting documentation so its command examples match; done means local startup succeeds without the service-command failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.