Skip to content

Commit 3ff1e3b

Browse files
authored
Addressing several issues (#1702)
* Fixes #1152 * Added note about MacOS and Safari. Fixes #1519 * Fixes #1108 * Remove code fence * Correct branding per Scott Addie
1 parent 507ce50 commit 3ff1e3b

File tree

6 files changed

+81
-59
lines changed

6 files changed

+81
-59
lines changed

docs/azureai/azureai-openai-integration.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
2-
title: .NET Aspire Azure AI OpenAI integration
3-
description: Learn how to use the .NET Aspire Azure AI OpenAI integration.
2+
title: .NET Aspire Azure OpenAI integration
3+
description: Learn how to use the .NET Aspire Azure OpenAI integration.
44
ms.topic: how-to
5-
ms.date: 08/12/2024
5+
ms.date: 09/27/2024
66
---
77

8-
# .NET Aspire Azure AI OpenAI integration
8+
# .NET Aspire Azure OpenAI integration
99

10-
In this article, you learn how to use the .NET Aspire Azure AI OpenAI client. The `Aspire.Azure.AI.OpenAI` library is used to register an `OpenAIClient` in the dependency injection (DI) container for consuming Azure AI OpenAI or OpenAI functionality. It enables corresponding logging and telemetry.
10+
In this article, you learn how to use the .NET Aspire Azure OpenAI client. The `Aspire.Azure.AI.OpenAI` library is used to register an `OpenAIClient` in the dependency injection (DI) container for consuming Azure OpenAI or OpenAI functionality. It enables corresponding logging and telemetry.
1111

1212
For more information on using the `OpenAIClient`, see [Quickstart: Get started generating text using Azure OpenAI Service](/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython&pivots=programming-language-csharp).
1313

1414
## Get started
1515

1616
- Azure subscription: [create one for free](https://azure.microsoft.com/free/).
17-
- Azure AI OpenAI or OpenAI account: [create an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource).
17+
- Azure OpenAI or OpenAI account: [create an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource).
1818

19-
To get started with the .NET Aspire Azure AI OpenAI integration, install the [Aspire.Azure.AI.OpenAI](https://www.nuget.org/packages/Aspire.Azure.AI.OpenAI) NuGet package in the client-consuming project, i.e., the project for the application that uses the Azure AI OpenAI client.
19+
To get started with the .NET Aspire Azure OpenAI integration, install the [Aspire.Azure.AI.OpenAI](https://www.nuget.org/packages/Aspire.Azure.AI.OpenAI) NuGet package in the client-consuming project, i.e., the project for the application that uses the Azure OpenAI client.
2020

2121
### [.NET CLI](#tab/dotnet-cli)
2222

@@ -54,7 +54,7 @@ public class ExampleService(OpenAIClient client)
5454

5555
## App host usage
5656

57-
To add Azure AI hosting support to your <xref:Aspire.Hosting.IDistributedApplicationBuilder>, install the [Aspire.Hosting.Azure.CognitiveServices](https://www.nuget.org/packages/Aspire.Hosting.Azure.CognitiveServices) NuGet package in the [app host](xref:aspire/app-host) project.
57+
To add Azure hosting support to your <xref:Aspire.Hosting.IDistributedApplicationBuilder>, install the [Aspire.Hosting.Azure.CognitiveServices](https://www.nuget.org/packages/Aspire.Hosting.Azure.CognitiveServices) NuGet package in the [app host](xref:aspire/app-host) project.
5858

5959
### [.NET CLI](#tab/dotnet-cli)
6060

@@ -71,7 +71,7 @@ dotnet add package Aspire.Hosting.Azure.CognitiveServices
7171

7272
---
7373

74-
In your app host project, register an Azure AI OpenAI resource using the following methods, such as <xref:Aspire.Hosting.AzureOpenAIExtensions.AddAzureOpenAI%2A>:
74+
In your app host project, register an Azure OpenAI resource using the following methods, such as <xref:Aspire.Hosting.AzureOpenAIExtensions.AddAzureOpenAI%2A>:
7575

7676
```csharp
7777
var builder = DistributedApplication.CreateBuilder(args);
@@ -92,7 +92,7 @@ builder.AddAzureAIOpenAI("openAiConnectionName");
9292

9393
## Configuration
9494

95-
The .NET Aspire Azure AI OpenAI integration provides multiple options to configure the connection based on the requirements and conventions of your project.
95+
The .NET Aspire Azure OpenAI integration provides multiple options to configure the connection based on the requirements and conventions of your project.
9696

9797
### Use a connection string
9898

@@ -106,7 +106,7 @@ The connection string is retrieved from the `ConnectionStrings` configuration se
106106

107107
#### Account endpoint
108108

109-
The recommended approach is to use an `Endpoint`, which works with the `AzureOpenAISettings.Credential` property to establish a connection. If no credential is configured, the <xref:Azure.Identity.DefaultAzureCredential> is used.
109+
The recommended approach is to use an **Endpoint**, which works with the `AzureOpenAISettings.Credential` property to establish a connection. If no credential is configured, the <xref:Azure.Identity.DefaultAzureCredential> is used.
110110

111111
```json
112112
{
@@ -116,6 +116,8 @@ The recommended approach is to use an `Endpoint`, which works with the `AzureOpe
116116
}
117117
```
118118

119+
For more information, see [Use Azure OpenAI without keys](/azure/developer/ai/keyless-connections).
120+
119121
#### Connection string
120122

121123
Alternatively, a custom connection string can be used.
@@ -132,7 +134,7 @@ In order to connect to the non-Azure OpenAI service, drop the `Endpoint` propert
132134

133135
### Use configuration providers
134136

135-
The .NET Aspire Azure AI OpenAI integration supports <xref:Microsoft.Extensions.Configuration>. It loads the `AzureOpenAISettings` from configuration by using the `Aspire:Azure:AI:OpenAI` key. Example _:::no-loc text="appsettings.json":::_ that configures some of the options:
137+
The .NET Aspire Azure OpenAI integration supports <xref:Microsoft.Extensions.Configuration>. It loads the `AzureOpenAISettings` from configuration by using the `Aspire:Azure:AI:OpenAI` key. Example _:::no-loc text="appsettings.json":::_ that configures some of the options:
136138

137139
```json
138140
{
@@ -171,14 +173,14 @@ builder.AddAzureAIOpenAI(
171173

172174
### Logging
173175

174-
The .NET Aspire Azure AI OpenAI integration uses the following log categories:
176+
The .NET Aspire Azure OpenAI integration uses the following log categories:
175177

176178
- `Azure`
177179
- `Azure.Core`
178180
- `Azure.Identity`
179181

180182
## See also
181183

182-
- [Azure AI OpenAI docs](/azure/ai-services/openai/overview)
184+
- [Azure OpenAI docs](/azure/ai-services/openai/overview)
183185
- [.NET Aspire integrations](../fundamentals/integrations-overview.md)
184186
- [.NET Aspire GitHub repo](https://github.com/dotnet/aspire)

docs/fundamentals/app-host-overview.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,28 @@ private static IResourceBuilder<RabbitMQServerResource> RunWithStableNodeName(
243243
}
244244
```
245245

246+
The execution context is often used to conditionally add resources or connection strings that point to existing resources. Consider the following example that demonstrates conditionally adding Redis or a connection string based on the execution context:
247+
248+
```csharp
249+
var builder = DistributedApplication.CreateBuilder(args);
250+
251+
var redis = builder.ExecutionContext.IsRunMode
252+
? builder.AddRedis("redis")
253+
: builder.AddConnectionString("redis");
254+
255+
builder.AddProject<Projects.WebApplication>("api")
256+
.WithReference(redis);
257+
258+
builder.Build().Run();
259+
```
260+
261+
In the preceding code:
262+
263+
- If the app host is running in "run" mode, a Redis container resource is added.
264+
- If the app host is running in "publish" mode, a connection string is added.
265+
266+
This logic can easily be inverted to connect to an existing Redis resource when you're running locally, and create a new Redis resource when you're publishing.
267+
246268
## See also
247269

248270
- [.NET Aspire integrations overview](integrations-overview.md)

docs/fundamentals/external-parameters.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: External parameters
33
description: Learn how to express parameters such as secrets, connection strings, and other configuration values that might vary between environments.
44
ms.topic: how-to
5-
ms.date: 08/20/2024
5+
ms.date: 09/27/2024
66
---
77

88
# External parameters
@@ -11,7 +11,7 @@ Environments provide context for the application to run in. Parameters express t
1111

1212
## Parameter values
1313

14-
Parameter values are read from the `Parameters` section of the app host's configuration and are used to provide values to the app while running locally. When deploying the app, the value will be asked for the parameter value.
14+
Parameter values are read from the `Parameters` section of the app host's configuration and are used to provide values to the app while running locally. When you publish the app, if the value isn't available you're prompted to provide it.
1515

1616
Consider the following app host _:::no-loc text="Program.cs":::_ example file:
1717

@@ -55,7 +55,7 @@ Parameters are represented in the manifest as a new primitive called `parameter.
5555

5656
## Secret values
5757

58-
Parameters can be used to model secrets. When a parameter is marked as a secret, this is a hint to the manifest that the value should be treated as a secret. When deploying, the value will be prompted for and stored in a secure location. When running locally, the value will be read from the `Parameters` section of the app host configuration.
58+
Parameters can be used to model secrets. When a parameter is marked as a secret, it serves as a hint to the manifest that the value should be treated as a secret. When you publish the app, the value is prompted for and stored in a secure location. When you run the app locally, the value is read from the `Parameters` section of the app host configuration.
5959

6060
Consider the following app host _:::no-loc text="Program.cs":::_ example file:
6161

@@ -102,7 +102,7 @@ The manifest representation is as follows:
102102

103103
## Connection string values
104104

105-
Parameters can be used to model connection strings. When deploying, the value will be prompted for and stored in a secure location. When running locally, the value will be read from the `ConnectionStrings` section of the app host configuration.
105+
Parameters can be used to model connection strings. When you publish the app, the value is prompted for and stored in a secure location. When you run the app locally, the value is read from the `ConnectionStrings` section of the app host configuration.
106106

107107
> [!NOTE]
108108
> Connection strings are used to represent a wide range of connection information including database connections, message brokers, and other services. In .NET Aspire nomenclature, the term "connection string" is used to represent any kind of connection information.
@@ -114,7 +114,7 @@ var builder = DistributedApplication.CreateBuilder(args);
114114

115115
var redis = builder.AddConnectionString("redis");
116116

117-
builder.AddProject<Projects.WebApplication1>("api")
117+
builder.AddProject<Projects.WebApplication>("api")
118118
.WithReference(redis);
119119

120120
builder.Build().Run();
@@ -151,7 +151,7 @@ The value for the `insertionRows` parameter is read from the `Parameters` sectio
151151

152152
:::code language="json" source="snippets/params/Parameters.AppHost/appsettings.json":::
153153

154-
The `Parameters_ApiService` project consumes the `insertionRows` parameter, consider the _:::no-loc text="Program.cs":::_ example file:
154+
The `Parameters_ApiService` project consumes the `insertionRows` parameter. Consider the _:::no-loc text="Program.cs":::_ example file:
155155

156156
:::code source="snippets/params/Parameters.ApiService/Program.cs":::
157157

docs/get-started/aspire-overview.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: .NET Aspire overview
33
description: Learn about .NET Aspire, an application stack designed to improve the experience of building cloud-native applications.
4-
ms.date: 08/12/2024
4+
ms.date: 09/27/2024
55
---
66

77
# .NET Aspire overview
@@ -27,7 +27,7 @@ A _distributed application_ is one that uses computational _resources_ across mu
2727

2828
- [**Orchestration**](#orchestration): .NET Aspire provides features for running and connecting multi-project applications and their dependencies for [local development environments](../fundamentals/networking-overview.md).
2929
- [**Integrations**](#net-aspire-integrations): .NET Aspire integrations are NuGet packages for commonly used services, such as Redis or Postgres, with standardized interfaces ensuring they connect consistently and seamlessly with your app.
30-
- [**Tooling**](#project-templates-and-tooling): .NET Aspire comes with project templates and tooling experiences for Visual Studio, Visual Studio Code, and the [dotnet CLI](/dotnet/core/tools/) to help you create and interact with .NET Aspire projects.
30+
- [**Tooling**](#project-templates-and-tooling): .NET Aspire comes with project templates and tooling experiences for Visual Studio, Visual Studio Code, and the [.NET CLI](/dotnet/core/tools/) to help you create and interact with .NET Aspire projects.
3131

3232
## Orchestration
3333

@@ -36,7 +36,7 @@ In .NET Aspire, orchestration primarily focuses on enhancing the _local developm
3636
.NET Aspire orchestration assists with the following concerns:
3737

3838
- **App composition**: Specify the .NET projects, containers, executables, and cloud resources that make up the application.
39-
- **Service discovery and connection string management**: The app host manages injecting the right connection strings or network configurations and service discovery information to simplify the developer experience.
39+
- **Service discovery and connection string management**: The app host manages to inject the right connection strings or network configurations and service discovery information to simplify the developer experience.
4040

4141
For example, using .NET Aspire, the following code creates a local Redis container resource and configures the appropriate connection string in the `"frontend"` project with only two helper method calls:
4242

@@ -55,11 +55,14 @@ builder.AddProject<Projects.MyFrontend>("frontend")
5555

5656
For more information, see [.NET Aspire orchestration overview](../fundamentals/app-host-overview.md).
5757

58+
> [!IMPORTANT]
59+
> The call to `AddRedis` creates a new Redis container in your local dev environment. If you'd rather use an existing Redis instance, you can use the `AddConnectionString` method to reference an existing connection string. For more information, see [Reference existing resources](../fundamentals/app-host-overview.md#reference-existing-resources).
60+
5861
## .NET Aspire integrations
5962

6063
[.NET Aspire integrations](../fundamentals/integrations-overview.md) are NuGet packages designed to simplify connections to popular services and platforms, such as Redis or PostgreSQL. .NET Aspire integrations handle many cloud-native concerns for you through standardized configuration patterns, such as adding health checks and telemetry. Integrations are two-fold, in that one side represents the service you're connecting to, and the other side represents the client or consumer of that service. In other words, for each hosting package there's a corresponding client package that handles the service connection.
6164

62-
Each integration is designed to work with .NET Aspire orchestration, and their configurations are injected automatically by simply referencing named resources. In other words, if _Example.ServiceFoo_ references _Example.ServiceBar_, _Example.ServiceFoo_ inherits the integration's required configurations to allow them to communicate with each other automatically.
65+
Each integration is designed to work with .NET Aspire orchestration, and their configurations are injected automatically by [referencing named resources](../fundamentals/app-host-overview.md#reference-resources). In other words, if _Example.ServiceFoo_ references _Example.ServiceBar_, _Example.ServiceFoo_ inherits the integration's required configurations to allow them to communicate with each other automatically.
6366

6467
For example, consider the following code using the .NET Aspire Service Bus integration:
6568

@@ -71,24 +74,13 @@ The <xref:Microsoft.Extensions.Hosting.AspireServiceBusExtensions.AddAzureServic
7174

7275
- Registers a <xref:Azure.Messaging.ServiceBus.ServiceBusClient> as a singleton in the DI container for connecting to Azure Service Bus.
7376
- Applies `ServiceBusClient` configurations either inline through code or through configuration.
74-
- Enables corresponding health checks, logging and telemetry specific to the Azure Service Bus usage.
77+
- Enables corresponding health checks, logging, and telemetry specific to the Azure Service Bus usage.
7578

7679
A full list of available integrations is detailed on the [.NET Aspire integrations](../fundamentals/integrations-overview.md) overview page.
7780

7881
## Project templates and tooling
7982

80-
.NET Aspire projects follow a standardized structure designed around the default .NET Aspire project templates. Most .NET Aspire projects have at least three projects:
81-
82-
- **MyFirstAspireApp**: Your starter app, which could be any common .NET project such as a Blazor UI or Minimal API. You can add more projects to your app as it expands and manage orchestration between them using the **.AppHost** and **.ServiceDefaults** project.
83-
- **MyFirstAspireApp.AppHost**: The **.AppHost** project is used to manage the high level orchestration concerns of the app. Orchestration involves putting together various parts of your app, like APIs, service containers, and executables, and setting up how they find and communicate with each other.
84-
- **MyFirstAspireApp.ServiceDefaults**: The **.ServiceDefaults** project contains default .NET Aspire project configurations that can be extended and customized as needed. These configurations include concerns such as setting up health checks, OpenTelemetry settings, and more.
85-
86-
There are currently two .NET Aspire starter templates available to help you get started with this structure:
87-
88-
- **.NET Aspire Application**: A basic starter template that only includes the **AspireSample.AppHost** and **AspireSample.ServiceDefaults** projects. This template is designed to only provide the essentials for you to build off of.
89-
- **.NET Aspire Starter Application**: This template includes the **AspireSample.AppHost** and **AspireSample.ServiceDefaults** projects, but also includes boilerplate UI and API projects. These projects are pre-configured with service discovery and other basic examples of common .NET Aspire functionality.
90-
91-
For more information, see [.NET Aspire setup and tooling](../fundamentals/setup-tooling.md).
83+
.NET Aspire provides a set of project templates and tooling experiences for Visual Studio, Visual Studio Code, and the [.NET CLI](/dotnet/core/tools/). These templates are designed to help you create and interact with .NET Aspire projects. The templates are opinionated and come with a set of defaults that help you get started quickly. They include boilerplate code and configurations that are common to cloud-native apps, such as telemetry, health checks, and service discovery. For more information, see [.NET Aspire project templates](../fundamentals/setup-tooling.md#net-aspire-project-templates).
9284

9385
.NET Aspire templates also include boilerplate extension methods that handle common service configurations for you:
9486

0 commit comments

Comments
 (0)