Skip to content

Commit 0f9943d

Browse files
IEvangelistCopilotJamesNKcaptainsafiaCopilot
authored
Content for Aspire v13 (#5199)
* Document ClaimActions configuration for dashboard OpenID Connect authentication (#5192) * Initial plan * Document ClaimActions configuration for dashboard OIDC authentication Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> * Apply suggestion from @JamesNK * Apply suggestion from @JamesNK * Apply suggestion from @JamesNK * Update configuration.md --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> Co-authored-by: James Newton-King <james@newtonking.com> * Document breaking change: DefaultAzureCredential defaults to ManagedIdentityCredential on ACA and App Service (#5303) * Initial plan * Add breaking change documentation for DefaultAzureCredential in 13.0 Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Fix markdown linting error - add blank line before list Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update docs/compatibility/13.0/defaultazurecredential-managedidentity-default.md --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> * Update Azure AI Foundry and GitHub Models documentation to use strongly-typed model constants (#5302) * Initial plan * Update documentation to use AIFoundryModel and GitHubModel constants Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update compatibility matrix to use GitHubModel constant Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Apply suggestions from code review --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> * Update environment variable format to polyglot-friendly pattern (#5320) * Initial plan * Update environment variable format to polyglot-friendly pattern Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update AppHost project documentation for Aspire 13.0 SDK format (#5319) * Initial plan * Update AppHost project section to show new SDK format for Aspire 13.0 Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Add AddCSharpApp and CSharpAppResource documentation to app-host-overview.md (#5318) * Initial plan * Add AddCSharpApp and CSharpAppResource documentation to app-host-overview.md Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Apply suggestions from code review * Update docs/fundamentals/app-host-overview.md --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> * Add breaking changes documentation for pipeline activity reporter API rename (PR #12137) (#5310) * Initial plan * Add breaking changes article for PR #12137 and update documentation Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Fix parameter naming consistency in breaking change examples Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Fix cross reference warnings by using inline code formatting Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> * Add documentation for ASPIREPIPELINES001, ASPIREPIPELINES002, and ASPIREPIPELINES003 diagnostics (#5359) * Initial plan * Add documentation for three new pipeline-related diagnostics Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com> * Fix ms.date to reflect current date in diagnostic documentation Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com> * Update diagnostic codes to use ASPIREPIPELINES001-003 instead of mixed naming scheme Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com> * Add ASPIREPIPELINES001-003 diagnostics to TOC Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Add Aspire MCP docs (#5446) * Update configuration * Document deployment state caching (#5301) * Initial plan * Add local deployment state documentation Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Address feedback: Add intros, italicize paths, add CI/CD example Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Rename and relocate deployment state doc outside Azure section Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Clarify cache save behavior in GitHub Actions example Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Add certificate trust customization article for Aspire 13 (#5311) * Initial plan * Add certificate trust customization article Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Fix cross-reference title to match actual article title Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Address PR feedback: update API examples, add runtime callout, document default scopes Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update callback APIs to use async Task and simplified context objects Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Replace deprecated callback APIs with new simplified APIs Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update documentation for new polyglot environment variables (issue #5308) (#5313) * Initial plan * Update documentation with new polyglot environment variable format Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Add clarification about resource names in environment variables Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Improve clarity of note about connection name parameter Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> * Update docs/fundamentals/app-host-overview.md --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> * Update documentation for Aspire 13 release * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: build --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> Co-authored-by: James Newton-King <james@newtonking.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2412c22 commit 0f9943d

35 files changed

+1317
-107
lines changed

.openpublishing.redirection.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@
335335
{
336336
"source_path_from_root": "/docs/fundamentals/build-container-images.md",
337337
"redirect_url": "/dotnet/aspire/fundamentals/custom-deployments"
338+
},
339+
{
340+
"source_path_from_root": "/docs/deployment/aspire-deploy/local-deployment-state.md",
341+
"redirect_url": "/dotnet/aspire/deployment/deployment-state-caching"
338342
}
339343
]
340344
}

docs/app-host/certificate-trust.md

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
---
2+
title: Certificate trust customization in Aspire
3+
description: Learn how to customize trusted certificates for Executable and Container resources in Aspire to enable secure communication.
4+
ms.date: 11/10/2025
5+
ai-usage: ai-assisted
6+
---
7+
8+
# Certificate trust customization in Aspire
9+
10+
In Aspire, you can customize which certificates resources consider trusted for TLS/HTTPS traffic. This is particularly useful for resources that don't use the system's root trusted certificates by default, such as containerized applications, Python apps, and Node.js apps. By configuring certificate trust, you enable these resources to communicate securely with services that use certificates they wouldn't otherwise trust, including the Aspire dashboard's OTLP endpoint.
11+
12+
> [!IMPORTANT]
13+
> Certificate trust customization only applies at run time. Custom certificates aren't included in publish or deployment artifacts.
14+
15+
## When to use certificate trust customization
16+
17+
Certificate trust customization is valuable when:
18+
19+
- Resources need to trust the ASP.NET Core Development Certificate for local HTTPS communication.
20+
- Containerized services must communicate with the dashboard over HTTPS.
21+
- Python or Node.js applications need to trust custom certificate authorities.
22+
- You're working with services that have specific certificate trust requirements.
23+
- Resources need to establish secure telemetry connections to the Aspire dashboard.
24+
25+
## Development certificate trust
26+
27+
By default, Aspire attempts to add trust for the ASP.NET Core Development Certificate to resources that wouldn't otherwise trust it. This enables resources to communicate with the dashboard OTEL collector endpoint over HTTPS and any other HTTPS endpoints secured by the development certificate.
28+
29+
You can control this behavior at the per-resource level using the `WithDeveloperCertificateTrust` API or through AppHost configuration settings.
30+
31+
### Configure development certificate trust per resource
32+
33+
To explicitly enable or disable development certificate trust for a specific resource:
34+
35+
```csharp
36+
var builder = DistributedApplication.CreateBuilder(args);
37+
38+
// Explicitly enable development certificate trust
39+
var nodeApp = builder.AddNpmApp("frontend", "../frontend")
40+
.WithDeveloperCertificateTrust(trust: true);
41+
42+
// Disable development certificate trust
43+
var pythonApp = builder.AddPythonApp("api", "../api", "main.py")
44+
.WithDeveloperCertificateTrust(trust: false);
45+
46+
builder.Build().Run();
47+
```
48+
49+
## Certificate authority collections
50+
51+
Certificate authority collections allow you to bundle custom certificates and make them available to resources. You create a collection using the `AddCertificateAuthorityCollection` method and then reference it from resources that need to trust those certificates.
52+
53+
### Create and use a certificate authority collection
54+
55+
```csharp
56+
using System.Security.Cryptography.X509Certificates;
57+
58+
var builder = DistributedApplication.CreateBuilder(args);
59+
60+
// Load your custom certificates
61+
var certificates = new X509Certificate2Collection();
62+
certificates.ImportFromPemFile("path/to/certificate.pem");
63+
64+
// Create a certificate authority collection
65+
var certBundle = builder.AddCertificateAuthorityCollection("my-bundle")
66+
.WithCertificates(certificates);
67+
68+
// Apply the certificate bundle to resources
69+
builder.AddNpmApp("my-project", "../myapp")
70+
.WithCertificateAuthorityCollection(certBundle);
71+
72+
builder.Build().Run();
73+
```
74+
75+
In the preceding example, the certificate bundle is created with custom certificates and then applied to a Node.js application, enabling it to trust those certificates.
76+
77+
## Certificate trust scopes
78+
79+
Certificate trust scopes control how custom certificates interact with a resource's default trusted certificates. Different scopes provide flexibility in managing certificate trust based on your application's requirements.
80+
81+
The `WithCertificateTrustScope` API accepts a `CertificateTrustScope` value to specify the trust behavior.
82+
83+
### Default trust scopes
84+
85+
Different resource types have different default trust scopes:
86+
87+
- **Append**: The default for most resources, appending custom certificates to the default trusted certificates.
88+
- **System**: The default for Python projects, which combines custom certificates with system root certificates because Python doesn't properly support Append mode.
89+
- **None**: The default for .NET projects on Windows, as there's no way to automatically change the default system store source.
90+
91+
### Append mode
92+
93+
Attempts to append the configured certificates to the default trusted certificates for a given resource. This mode is useful when you want to add trust for additional certificates while maintaining trust for the system's default certificates.
94+
95+
```csharp
96+
var builder = DistributedApplication.CreateBuilder(args);
97+
98+
builder.AddNodeApp("api", "../api")
99+
.WithCertificateTrustScope(CertificateTrustScope.Append);
100+
101+
builder.Build().Run();
102+
```
103+
104+
> [!NOTE]
105+
> Not all languages and runtimes support Append mode. For example, Python doesn't natively support appending certificates to the default trust store.
106+
107+
### Override mode
108+
109+
Attempts to override a resource to only trust the configured certificates, replacing the default trusted certificates entirely. This mode is useful when you need strict control over which certificates are trusted.
110+
111+
```csharp
112+
var builder = DistributedApplication.CreateBuilder(args);
113+
114+
var certBundle = builder.AddCertificateAuthorityCollection("custom-certs")
115+
.WithCertificates(myCertificates);
116+
117+
builder.AddPythonModule("api", "./api", "uvicorn")
118+
.WithCertificateAuthorityCollection(certBundle)
119+
.WithCertificateTrustScope(CertificateTrustScope.Override);
120+
121+
builder.Build().Run();
122+
```
123+
124+
### System mode
125+
126+
Attempts to combine the configured certificates with the default system root certificates and use them to override the default trusted certificates for a resource. This mode is intended to support Python or other languages that don't work well with Append mode.
127+
128+
```csharp
129+
var builder = DistributedApplication.CreateBuilder(args);
130+
131+
builder.AddPythonApp("worker", "../worker", "main.py")
132+
.WithCertificateTrustScope(CertificateTrustScope.System);
133+
134+
builder.Build().Run();
135+
```
136+
137+
### None mode
138+
139+
Disables all custom certificate trust for the resource, causing it to rely solely on its default certificate trust behavior.
140+
141+
```csharp
142+
var builder = DistributedApplication.CreateBuilder(args);
143+
144+
builder.AddContainer("service", "myimage")
145+
.WithCertificateTrustScope(CertificateTrustScope.None);
146+
147+
builder.Build().Run();
148+
```
149+
150+
## Custom certificate trust configuration
151+
152+
For advanced scenarios, you can specify custom certificate trust behavior using a callback API. This callback allows you to customize the command line arguments and environment variables required to configure certificate trust for different resource types.
153+
154+
### Configure certificate trust with a callback
155+
156+
Use `WithCertificateTrustConfiguration` to customize how certificate trust is configured for a resource:
157+
158+
```csharp
159+
var builder = DistributedApplication.CreateBuilder(args);
160+
161+
builder.AddContainer("api", "myimage")
162+
.WithCertificateTrustConfiguration(async (ctx) =>
163+
{
164+
// Add a command line argument
165+
ctx.Arguments.Add("--use-system-ca");
166+
167+
// Set environment variables with certificate paths
168+
// CertificateBundlePath resolves to the path of the custom certificate bundle file
169+
ctx.EnvironmentVariables["MY_CUSTOM_CERT_VAR"] = ctx.CertificateBundlePath;
170+
171+
// CertificateDirectoriesPath resolves to paths containing individual certificates
172+
ctx.EnvironmentVariables["CERTS_DIR"] = ctx.CertificateDirectoriesPath;
173+
174+
await Task.CompletedTask;
175+
});
176+
177+
builder.Build().Run();
178+
```
179+
180+
The callback receives a `CertificateTrustConfigurationCallbackAnnotationContext` that provides:
181+
182+
- `Scope`: The `CertificateTrustScope` for the resource.
183+
- `Arguments`: Command line arguments for the resource. Values can be strings or path providers like `CertificateBundlePath` or `CertificateDirectoriesPath`.
184+
- `EnvironmentVariables`: Environment variables for configuring certificate trust. The dictionary key is the environment variable name; values can be strings or path providers. By default, includes `SSL_CERT_DIR` and may include `SSL_CERT_FILE` if Override or System scope is configured.
185+
- `CertificateBundlePath`: A value provider that resolves to the path of a custom certificate bundle file.
186+
- `CertificateDirectoriesPath`: A value provider that resolves to paths containing individual certificates.
187+
188+
Default implementations are provided for Node.js, Python, and container resources. Container resources rely on standard OpenSSL configuration options, with default values that support the majority of common Linux distributions.
189+
190+
### Configure container certificate paths
191+
192+
For container resources, you can customize where certificates are stored and accessed using `WithContainerCertificatePaths`:
193+
194+
```csharp
195+
var builder = DistributedApplication.CreateBuilder(args);
196+
197+
builder.AddContainer("api", "myimage")
198+
.WithContainerCertificatePaths(
199+
customCertificatesDestination: "/custom/certs/path",
200+
defaultCertificateBundlePaths: ["/etc/ssl/certs/ca-certificates.crt"],
201+
defaultCertificateDirectoryPaths: ["/etc/ssl/certs"]);
202+
203+
builder.Build().Run();
204+
```
205+
206+
The `WithContainerCertificatePaths` API accepts three optional parameters:
207+
208+
- `customCertificatesDestination`: Overrides the base path in the container where custom certificate files are placed. If not set or set to `null`, the default path of `/usr/lib/ssl/aspire` is used.
209+
- `defaultCertificateBundlePaths`: Overrides the path(s) in the container where a default certificate authority bundle file is located. When the `CertificateTrustScope` is Override or System, the custom certificate bundle is additionally written to these paths. If not set or set to `null`, a set of default certificate paths for common Linux distributions is used.
210+
- `defaultCertificateDirectoryPaths`: Overrides the path(s) in the container where individual trusted certificate files are found. When the `CertificateTrustScope` is Append, these paths are concatenated with the path to the uploaded certificate artifacts. If not set or set to `null`, a set of default certificate paths for common Linux distributions is used.
211+
212+
> [!NOTE]
213+
> All desired paths must be configured in a single call to `WithContainerCertificatePaths` as only the most recent call to the API is honored.
214+
215+
## Common scenarios
216+
217+
### Enable HTTPS telemetry to the dashboard
218+
219+
By default, Aspire enables development certificate trust for resources, allowing them to send telemetry to the dashboard over HTTPS:
220+
221+
```csharp
222+
var builder = DistributedApplication.CreateBuilder(args);
223+
224+
// Development certificate trust is enabled by default
225+
var nodeApp = builder.AddNpmApp("frontend", "../frontend");
226+
var pythonApp = builder.AddPythonApp("api", "../api", "main.py");
227+
228+
builder.Build().Run();
229+
```
230+
231+
### Trust custom certificates in containers
232+
233+
When working with containerized services that need to trust custom certificates:
234+
235+
```csharp
236+
using System.Security.Cryptography.X509Certificates;
237+
238+
var builder = DistributedApplication.CreateBuilder(args);
239+
240+
// Load custom CA certificates
241+
var customCerts = new X509Certificate2Collection();
242+
customCerts.Import("corporate-ca.pem");
243+
244+
var certBundle = builder.AddCertificateAuthorityCollection("corporate-certs")
245+
.WithCertificates(customCerts);
246+
247+
// Apply to container
248+
builder.AddContainer("service", "myservice:latest")
249+
.WithCertificateAuthorityCollection(certBundle);
250+
251+
builder.Build().Run();
252+
```
253+
254+
### Disable certificate trust for Python apps
255+
256+
Python projects use System mode by default. To disable certificate trust customization for a Python app:
257+
258+
```csharp
259+
var builder = DistributedApplication.CreateBuilder(args);
260+
261+
// Disable certificate trust for Python apps
262+
builder.AddPythonModule("api", "./api", "uvicorn")
263+
.WithCertificateTrustScope(CertificateTrustScope.None);
264+
265+
builder.Build().Run();
266+
```
267+
268+
## Limitations
269+
270+
Certificate trust customization has the following limitations:
271+
272+
- Currently supported only in run mode, not in publish mode.
273+
- Not all languages and runtimes support all trust scope modes.
274+
- Python applications don't natively support Append mode.
275+
- Custom certificate trust requires appropriate runtime support within the resource.
276+
277+
## See also
278+
279+
- [Host external executables in Aspire](executable-resources.md)
280+
- [Add Dockerfiles to your .NET app model](withdockerfile.md)
281+
- [AppHost configuration](configuration.md)

docs/azureai/ai-integrations-compatibility-matrix.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ The [Aspire.Hosting.GitHub.Models](https://www.nuget.org/packages/Aspire.Hosting
118118
```csharp
119119
var builder = DistributedApplication.CreateBuilder(args);
120120

121-
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini");
121+
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
122+
var chat = builder.AddGitHubModel("chat", model);
122123

123124
builder.AddProject<Projects.ExampleProject>()
124125
.WithReference(chat);

docs/azureai/azureai-foundry-integration.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ var builder = DistributedApplication.CreateBuilder(args);
6363

6464
var foundry = builder.AddAzureAIFoundry("foundry");
6565

66-
var chat = foundry.AddDeployment("chat", "Phi-4", "1", "Microsoft");
66+
var model = AIFoundryModel.Microsoft.Phi4;
67+
var chat = foundry.AddDeployment("chat", model);
6768

6869
builder.AddProject<Projects.ExampleProject>()
6970
.WithReference(chat)
@@ -75,17 +76,18 @@ builder.AddProject<Projects.ExampleProject>()
7576
The preceding code:
7677

7778
- Adds an Azure AI Foundry resource named `foundry`.
78-
- Adds an Azure AI Foundry deployment resource named `chat` with a model name of `Phi-4`. The model name must correspond to an [available model](/azure/ai-foundry/foundry-models/concepts/models) in the Azure AI Foundry service.
79+
- Adds an Azure AI Foundry deployment resource named `chat` using the <xref:Aspire.Hosting.Azure.AIFoundryModel> constant for Phi-4. The model must correspond to an [available model](/azure/ai-foundry/foundry-models/concepts/models) in the Azure AI Foundry service.
7980

80-
> [!NOTE]
81-
> The `format` parameter of the `AddDeployment(...)` method can be found in the Azure AI Foundry portal in the details page of the model, right after the `Quick facts` text.
81+
> [!TIP]
82+
> Use the strongly-typed <xref:Aspire.Hosting.Azure.AIFoundryModel> constants to avoid typos and ensure you're using valid model identifiers. These constants are grouped by publisher (for example, `AIFoundryModel.Microsoft.Phi4`, `AIFoundryModel.OpenAI.Gpt4o`).
8283
8384
### Configure deployment properties
8485

8586
You can customize deployment properties using the <xref:Aspire.Hosting.AzureAIFoundryExtensions.WithProperties*> method:
8687

8788
```csharp
88-
var chat = foundry.AddDeployment("chat", "Phi-4", "1", "Microsoft")
89+
var model = AIFoundryModel.Microsoft.Phi4;
90+
var chat = foundry.AddDeployment("chat", model)
8991
.WithProperties(deployment =>
9092
{
9193
deployment.SkuName = "Standard";
@@ -131,7 +133,8 @@ var builder = DistributedApplication.CreateBuilder(args);
131133
var foundry = builder.AddAzureAIFoundry("foundry")
132134
.RunAsFoundryLocal();
133135

134-
var chat = foundry.AddDeployment("chat", "phi-3.5-mini", "1", "Microsoft");
136+
var model = AIFoundryModel.Local.Phi35Mini;
137+
var chat = foundry.AddDeployment("chat", model);
135138

136139
builder.AddProject<Projects.ExampleProject>()
137140
.WithReference(chat)
@@ -144,6 +147,9 @@ When the AppHost starts up, the local foundry service is also started. This requ
144147

145148
The <xref:Aspire.Hosting.AzureAIFoundryExtensions.RunAsFoundryLocal*> method configures the resource to run as an emulator. It downloads and loads the specified models locally. The method provides health checks for the local service and automatically manages the Foundry Local lifecycle.
146149

150+
> [!TIP]
151+
> Use the strongly-typed `AIFoundryModel.Local` constants for local development models. These constants are specifically optimized for Foundry Local (for example, `AIFoundryModel.Local.Phi4Mini`, `AIFoundryModel.Local.DeepseekR17b`).
152+
147153
### Assign roles to resources
148154

149155
You can assign specific roles to resources that need to access the Azure AI Foundry service. Use the <xref:Aspire.Hosting.AzureAIFoundryExtensions.WithRoleAssignments*> method:

docs/cli-reference/aspire-deploy.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ The following options are available:
5555

5656
- [!INCLUDE [option-project](includes/option-project.md)]
5757

58+
- **`-e, --environment`**
59+
60+
The deployment environment name. Defaults to `production`. Each environment maintains its own isolated deployment state file.
61+
62+
- **`--clear-cache`**
63+
64+
Clears the cached deployment state for the specified environment before deploying. When used, the deployment prompts for all values but doesn't save them to cache.
65+
5866
- **`-o, --output-path`**
5967

6068
The output path for deployment artifacts. Defaults to a folder named _deploy_ in the current directory.
@@ -84,3 +92,25 @@ The following options are available:
8492
```Command
8593
aspire deploy --project './projects/apphost/orchestration.AppHost.csproj' -- -fast
8694
```
95+
96+
- Deploy to a specific environment:
97+
98+
```Command
99+
aspire deploy --environment staging
100+
```
101+
102+
- Clear cached deployment state and deploy:
103+
104+
```Command
105+
aspire deploy --clear-cache
106+
```
107+
108+
- Clear cached deployment state for a specific environment:
109+
110+
```Command
111+
aspire deploy --environment staging --clear-cache
112+
```
113+
114+
## See also
115+
116+
- [Deployment state caching](../deployment/deployment-state-caching.md)

0 commit comments

Comments
 (0)