diff --git a/docs/azureai/azureai-search-document-integration.md b/docs/azureai/azureai-search-document-integration.md index 1e93268d3b..ce0aad6d60 100644 --- a/docs/azureai/azureai-search-document-integration.md +++ b/docs/azureai/azureai-search-document-integration.md @@ -186,7 +186,7 @@ builder.AddAzureSearch( static options => options.Diagnostics.ApplicationId = "CLIENT_ID")); ``` -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] The .NET Aspire Azure AI Search Documents integration implements a single health check, that calls the <xref:Azure.Search.Documents.Indexes.SearchIndexClient.GetServiceStatisticsAsync%2A> method on the `SearchIndexClient` to verify that the service is available. diff --git a/docs/caching/azure-cache-for-redis-distributed-caching-integration.md b/docs/caching/azure-cache-for-redis-distributed-caching-integration.md new file mode 100644 index 0000000000..58f4c2a89b --- /dev/null +++ b/docs/caching/azure-cache-for-redis-distributed-caching-integration.md @@ -0,0 +1,126 @@ +--- +title: Azure Cache for Redis distributed caching integration +description: Learn how to integrate Azure Cache for Redis as a distributed caching solution with the .NET Aspire stack. +ms.date: 02/05/2025 +--- + +# .NET Aspire Azure Cache for Redis®<sup>**[*](#registered)**</sup> distributed caching integration + +<a name="heading"></a> + +[!INCLUDE [includes-hosting-and-client](../includes/includes-hosting-and-client.md)] + +[!INCLUDE [azure-redis-intro](includes/azure-redis-intro.md)] + +The .NET Aspire Azure Cache for Redis integration enables you to connect to existing Azure Cache for Redis instances, or create new instances from .NET with the [`docker.io/library/redis` container image](https://hub.docker.com/_/redis/). + +## Hosting integration + +[!INCLUDE [azure-redis-app-host](includes/azure-redis-app-host.md)] + +## Client integration + +[!INCLUDE [redis-distributed-client-nuget](includes/redis-distributed-client-nuget.md)] + +### Add Redis distributed cache client + +In the _:::no-loc text="Program.cs":::_ file of your client-consuming project, call the <xref:Microsoft.Extensions.Hosting.AspireRedisDistributedCacheExtensions.AddRedisDistributedCache%2A> extension to register the required services for distributed caching and add a <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> for use via the dependency injection container. + +```csharp +builder.AddRedisDistributedCache(connectionName: "cache"); +``` + +> [!TIP] +> The `connectionName` parameter must match the name used when adding the Azure Cache for Redis resource in the app host project. For more information, see [Add Azure Cache for Redis resource](#add-azure-cache-for-redis-resource). + +You can then retrieve the `IDistributedCache` instance using dependency injection. For example, to retrieve the cache from a service: + +```csharp +public class ExampleService(IDistributedCache cache) +{ + // Use cache... +} +``` + +For more information on dependency injection, see [.NET dependency injection](/dotnet/core/extensions/dependency-injection). + +[!INCLUDE [azure-redis-distributed-client](includes/azure-redis-distributed-client.md)] + +### Add keyed Redis client + +There might be situations where you want to register multiple `IDistributedCache` instances with different connection names. To register keyed Redis clients, call the <xref:Microsoft.Extensions.Hosting.AspireRedisDistributedCacheExtensions.AddKeyedRedisDistributedCache*> method: + +```csharp +builder.AddKeyedRedisDistributedCache(name: "chat"); +builder.AddKeyedRedisDistributedCache(name: "product"); +``` + +Then you can retrieve the `IDistributedCache` instances using dependency injection. For example, to retrieve the connection from an example service: + +```csharp +public class ExampleService( + [FromKeyedServices("chat")] IDistributedCache chatCache, + [FromKeyedServices("product")] IDistributedCache productCache) +{ + // Use caches... +} +``` + +For more information on keyed services, see [.NET dependency injection: Keyed services](/dotnet/core/extensions/dependency-injection#keyed-services). + +### Configuration + +The .NET Aspire Redis distributed caching integration provides multiple options to configure the Redis connection based on the requirements and conventions of your project. + +#### Use a connection string + +When using a connection string from the `ConnectionStrings` configuration section, you can provide the name of the connection string when calling `builder.AddRedisDistributedCache`: + +```csharp +builder.AddRedisDistributedCache("cache"); +``` + +And then the connection string will be retrieved from the `ConnectionStrings` configuration section: + +```json +{ + "ConnectionStrings": { + "cache": "localhost:6379" + } +} +``` + +For more information on how to format this connection string, see the [Stack Exchange Redis configuration docs](https://stackexchange.github.io/StackExchange.Redis/Configuration.html#basic-configuration-strings). + +#### Use configuration providers + +[!INCLUDE [redis-distributed-client-json-settings](includes/redis-distributed-client-json-settings.md)] + +#### Use inline delegates + +You can also pass the `Action<StackExchangeRedisSettings>` delegate to set up some or all the options inline, for example to configure `DisableTracing`: + +```csharp +builder.AddRedisDistributedCache( + "cache", + settings => settings.DisableTracing = true); +``` + +You can also set up the [ConfigurationOptions](https://stackexchange.github.io/StackExchange.Redis/Configuration.html#configuration-options) using the `Action<ConfigurationOptions> configureOptions` delegate parameter of the `AddRedisDistributedCache` method. For example to set the connection timeout: + +```csharp +builder.AddRedisDistributedCache( + "cache", + static settings => settings.ConnectTimeout = 3_000); +``` + +[!INCLUDE [redis-distributed-client-health-checks-and-diagnostics](includes/redis-distributed-client-health-checks-and-diagnostics.md)] + +## See also + +- [Azure Cache for Redis docs](/azure/azure-cache-for-redis/) +- [Stack Exchange Redis docs](https://stackexchange.github.io/StackExchange.Redis/) +- [.NET Aspire integrations](../fundamentals/integrations-overview.md) +- [.NET Aspire GitHub repo](https://github.com/dotnet/aspire) + +[!INCLUDE [redis-trademark](includes/redis-trademark.md)] diff --git a/docs/caching/azure-cache-for-redis-integration.md b/docs/caching/azure-cache-for-redis-integration.md new file mode 100644 index 0000000000..4323505b1f --- /dev/null +++ b/docs/caching/azure-cache-for-redis-integration.md @@ -0,0 +1,118 @@ +--- +title: Azure Cache for Redis integration +description: Learn how to integrate Azure Cache for Redis with the .NET Aspire stack. +ms.date: 02/05/2025 +--- + +# .NET Aspire Azure Cache for Redis®<sup>**[*](#registered)**</sup> integration + +<a name="heading"></a> + +[!INCLUDE [includes-hosting-and-client](../includes/includes-hosting-and-client.md)] + +[!INCLUDE [azure-redis-intro](includes/azure-redis-intro.md)] + +The .NET Aspire Azure Cache for Redis integration enables you to connect to existing Azure Cache for Redis instances, or create new instances, or run as a container locally from .NET with the [`docker.io/library/redis` container image](https://hub.docker.com/_/redis/). + +## Hosting integration + +[!INCLUDE [azure-redis-app-host](includes/azure-redis-app-host.md)] + +## Client integration + +[!INCLUDE [redis-client-nuget](includes/redis-client-nuget.md)] + +### Add Redis client + +In the _:::no-loc text="Program.cs":::_ file of your client-consuming project, call the <xref:Microsoft.Extensions.Hosting.AspireRedisExtensions.AddRedisClient*> extension method on any <xref:Microsoft.Extensions.Hosting.IHostApplicationBuilder> to register an `IConnectionMultiplexer` for use via the dependency injection container. The method takes a connection name parameter. + +```csharp +builder.AddRedisClient(connectionName: "cache"); +``` + +> [!TIP] +> The `connectionName` parameter must match the name used when adding the Azure Cache for Redis resource in the app host project. For more information, see [Add Azure Cache for Redis resource](#add-azure-cache-for-redis-resource). + +You can then retrieve the `IConnectionMultiplexer` instance using dependency injection. For example, to retrieve the connection from an example service: + +```csharp +public class ExampleService(IConnectionMultiplexer connectionMux) +{ + // Use connection multiplexer... +} +``` + +For more information on dependency injection, see [.NET dependency injection](/dotnet/core/extensions/dependency-injection). + +[!INCLUDE [azure-redis-client](includes/azure-redis-client.md)] + +### Add keyed Redis client + +There might be situations where you want to register multiple `IConnectionMultiplexer` instances with different connection names. To register keyed Redis clients, call the <xref:Microsoft.Extensions.Hosting.AspireRedisExtensions.AddKeyedRedisClient*> method: + +```csharp +builder.AddKeyedRedisClient(name: "chat"); +builder.AddKeyedRedisClient(name: "queue"); +``` + +Then you can retrieve the `IConnectionMultiplexer` instances using dependency injection. For example, to retrieve the connection from an example service: + +```csharp +public class ExampleService( + [FromKeyedServices("chat")] IConnectionMultiplexer chatConnectionMux, + [FromKeyedServices("queue")] IConnectionMultiplexer queueConnectionMux) +{ + // Use connections... +} +``` + +For more information on keyed services, see [.NET dependency injection: Keyed services](/dotnet/core/extensions/dependency-injection#keyed-services). + +### Configuration + +The .NET Aspire Stack Exchange Redis client integration provides multiple options to configure the Redis connection based on the requirements and conventions of your project. + +#### Use a connection string + +When using a connection string from the `ConnectionStrings` configuration section, you can provide the name of the connection string when calling <xref:Aspire.Hosting.RedisBuilderExtensions.AddRedis*>: + +```csharp +builder.AddRedis("cache"); +``` + +Then the connection string will be retrieved from the `ConnectionStrings` configuration section: + +```json +{ + "ConnectionStrings": { + "cache": "localhost:6379" + } +} +``` + +For more information on how to format this connection string, see the [Stack Exchange Redis configuration docs](https://stackexchange.github.io/StackExchange.Redis/Configuration.html#basic-configuration-strings). + +#### Use configuration providers + +[!INCLUDE [redis-client-json-settings](includes/redis-client-json-settings.md)] + +#### Use inline delegates + +You can also pass the `Action<StackExchangeRedisSettings>` delegate to set up some or all the options inline, for example to configure `DisableTracing`: + +```csharp +builder.AddRedisClient( + "cache", + static settings => settings.DisableTracing = true); +``` + +[!INCLUDE [redis-client-health-checks-and-diagnostics](includes/redis-client-health-checks-and-diagnostics.md)] + +## See also + +- [Azure Cache for Redis docs](/azure/azure-cache-for-redis/) +- [Stack Exchange Redis docs](https://stackexchange.github.io/StackExchange.Redis/) +- [.NET Aspire integrations](../fundamentals/integrations-overview.md) +- [.NET Aspire GitHub repo](https://github.com/dotnet/aspire) + +[!INCLUDE [redis-trademark](includes/redis-trademark.md)] diff --git a/docs/caching/azure-cache-for-redis-output-caching-integration.md b/docs/caching/azure-cache-for-redis-output-caching-integration.md new file mode 100644 index 0000000000..0fa8000491 --- /dev/null +++ b/docs/caching/azure-cache-for-redis-output-caching-integration.md @@ -0,0 +1,114 @@ +--- +title: Azure Cache for Redis output caching integration +description: Learn how to integrate Azure Cache for Redis as an output caching solution with the .NET Aspire stack. +ms.date: 02/05/2025 +--- + +# .NET Aspire Azure Cache for Redis®<sup>**[*](#registered)**</sup> output caching integration + +<a name="heading"></a> + +[!INCLUDE [includes-hosting-and-client](../includes/includes-hosting-and-client.md)] + +[!INCLUDE [azure-redis-intro](includes/azure-redis-intro.md)] + +The .NET Aspire Azure Cache for Redis integration enables you to connect to existing Azure Cache for Redis instances, or create new instances from .NET with the [`docker.io/library/redis` container image](https://hub.docker.com/_/redis/). + +## Hosting integration + +[!INCLUDE [azure-redis-app-host](includes/azure-redis-app-host.md)] + +## Client integration + +[!INCLUDE [redis-output-client-nuget](includes/redis-output-client-nuget.md)] + +### Add output caching + +In the _:::no-loc text="Program.cs":::_ file of your client-consuming project, call the <xref:Microsoft.Extensions.Hosting.AspireRedisOutputCacheExtensions.AddRedisOutputCache%2A> extension method on any <xref:Microsoft.Extensions.Hosting.IHostApplicationBuilder> to register the required services for output caching. + +```csharp +builder.AddRedisOutputCache(connectionName: "cache"); +``` + +> [!TIP] +> The `connectionName` parameter must match the name used when adding the Azure Cache for Redis resource in the app host project. For more information, see [Add Azure Cache for Redis resource](#add-azure-cache-for-redis-resource). + +Add the middleware to the request processing pipeline by calling <xref:Microsoft.AspNetCore.Builder.OutputCacheApplicationBuilderExtensions.UseOutputCache(Microsoft.AspNetCore.Builder.IApplicationBuilder)>: + +```csharp +var app = builder.Build(); + +app.UseOutputCache(); +``` + +For [minimal API apps](/aspnet/core/fundamentals/minimal-apis/overview), configure an endpoint to do caching by calling <xref:Microsoft.Extensions.DependencyInjection.OutputCacheConventionBuilderExtensions.CacheOutput%2A>, or by applying the <xref:Microsoft.AspNetCore.OutputCaching.OutputCacheAttribute>, as shown in the following examples: + +```csharp +app.MapGet("/cached", () => "Hello world!") + .CacheOutput(); + +app.MapGet( + "/attribute", + [OutputCache] () => "Hello world!"); +``` + +For apps with controllers, apply the `[OutputCache]` attribute to the action method. For Razor Pages apps, apply the attribute to the Razor page class. + +[!INCLUDE [azure-redis-output-client](includes/azure-redis-output-client.md)] + +### Configuration + +The .NET Aspire Stack Exchange Redis output caching integration provides multiple options to configure the Redis connection based on the requirements and conventions of your project. + +#### Use a connection string + +When using a connection string from the `ConnectionStrings` configuration section, you can provide the name of the connection string when calling <xref:Microsoft.Extensions.Hosting.AspireRedisOutputCacheExtensions.AddRedisOutputCache*>: + +```csharp +builder.AddRedisOutputCache(connectionName: "cache"); +``` + +Then the connection string will be retrieved from the `ConnectionStrings` configuration section: + +```json +{ + "ConnectionStrings": { + "cache": "localhost:6379" + } +} +``` + +For more information on how to format this connection string, see the [Stack Exchange Redis configuration docs](https://stackexchange.github.io/StackExchange.Redis/Configuration.html#basic-configuration-strings). + +#### Use configuration providers + +[!INCLUDE [redis-output-client-json-settings](includes/redis-output-client-json-settings.md)] + +#### Use inline delegates + +You can also pass the `Action<StackExchangeRedisSettings> configurationSettings` delegate to set up some or all the options inline, for example to disable health checks from code: + +```csharp +builder.AddRedisOutputCache( + "cache", + static settings => settings.DisableHealthChecks = true); +``` + +You can also set up the [ConfigurationOptions](https://stackexchange.github.io/StackExchange.Redis/Configuration.html#configuration-options) using the `Action<ConfigurationOptions> configureOptions` delegate parameter of the <xref:Microsoft.Extensions.Hosting.AspireRedisOutputCacheExtensions.AddRedisOutputCache%2A> method. For example to set the connection timeout: + +```csharp +builder.AddRedisOutputCache( + "cache", + static settings => settings.ConnectTimeout = 3_000); +``` + +[!INCLUDE [redis-output-client-health-checks-and-diagnostics](includes/redis-output-client-health-checks-and-diagnostics.md)] + +## See also + +- [Azure Cache for Redis docs](/azure/azure-cache-for-redis/) +- [Stack Exchange Redis docs](https://stackexchange.github.io/StackExchange.Redis/) +- [.NET Aspire integrations](../fundamentals/integrations-overview.md) +- [.NET Aspire GitHub repo](https://github.com/dotnet/aspire) + +[!INCLUDE [redis-trademark](includes/redis-trademark.md)] diff --git a/docs/caching/caching-integrations.md b/docs/caching/caching-integrations.md index 2438b3cf1a..58381e211d 100644 --- a/docs/caching/caching-integrations.md +++ b/docs/caching/caching-integrations.md @@ -1,7 +1,7 @@ --- title: Implement caching with .NET Aspire integrations description: Learn how to connect to Redis and cache data using .NET Aspire integrations. -ms.date: 11/08/2024 +ms.date: 02/05/2025 ms.topic: tutorial --- @@ -172,7 +172,7 @@ Configuring connection string with this method, while functional, requires dupli await cache.SetAsync("forecast", Encoding.UTF8.GetBytes(JsonSerializer.Serialize(forecast)), new () { AbsoluteExpiration = DateTime.Now.AddSeconds(10) - }); ; + }); return forecast; } diff --git a/docs/caching/includes/azure-redis-app-host.md b/docs/caching/includes/azure-redis-app-host.md index 8a7ce49019..442b1833bb 100644 --- a/docs/caching/includes/azure-redis-app-host.md +++ b/docs/caching/includes/azure-redis-app-host.md @@ -2,9 +2,7 @@ ms.topic: include --- -### Azure Redis hosting integration - -To deploy your Redis resources to Azure, install the [π¦ Aspire.Hosting.Azure.Redis](https://www.nuget.org/packages/Aspire.Hosting.Azure.Redis) NuGet package: +The .NET Aspire Azure Cache for Redis hosting integration models an Azure Redis resource as the <xref:Aspire.Hosting.Azure.AzureRedisCacheResource> type. To access this type and APIs for expressing them as resources in your [app host](xref:dotnet/aspire/app-host) project, add the [π¦ Aspire.Hosting.Azure.Redis](https://www.nuget.org/packages/Aspire.Hosting.Azure.Redis) NuGet package: ### [.NET CLI](#tab/dotnet-cli) @@ -21,20 +19,146 @@ dotnet add package Aspire.Hosting.Azure.Redis --- -#### Add Azure Cache for Redis server resource +For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-package) or [Manage package dependencies in .NET applications](/dotnet/core/tools/dependencies). + +### Add Azure Cache for Redis resource -After you've installed the .NET Aspire hosting Azure Redis package, call the `AddAzureRedis` extension method in your app host project: +In your app host project, call <xref:Aspire.Hosting.AzureRedisExtensions.AddAzureRedis*> on the `builder` instance to add an Azure Cache for Redis resource, as shown in the following example: ```csharp var builder = DistributedApplication.CreateBuilder(args); -var cache = builder.AddAzureRedis("azcache") +var cache = builder.AddAzureRedis("azcache"); + +builder.AddProject<Projects.ExampleProject>() + .WithReference(cache); -var exampleProject = builder.AddProject<Projects.ExampleProject>() - .WithReference(cache); +// After adding all resources, run the app... ``` The preceding call to `AddAzureRedis` configures the Redis server resource to be deployed as an [Azure Cache for Redis](/azure/azure-cache-for-redis/cache-overview). > [!IMPORTANT] > By default, `AddAzureRedis` configures [Microsoft Entra ID](/azure/azure-cache-for-redis/cache-azure-active-directory-for-authentication) authentication. This requires changes to applications that need to connect to these resources, for example, client integrations. + +> [!TIP] +> When you call <xref:Aspire.Hosting.AzureRedisExtensions.AddAzureRedis*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning*>βwhich adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Local provisioning: Configuration](../../azure/local-provisioning.md#configuration). + +#### Generated provisioning Bicep + +If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure Cache for Redis resource, the following Bicep is generated: + +<!-- markdownlint-disable MD033 --> +<br/> +<details> +<summary id="azure-redis"><strong>Toggle Azure Cache for Redis Bicep.</strong></summary> +<p aria-labelledby="azure-redis"> + +:::code language="bicep" source="../../snippets/azure/AppHost/redis.module.bicep"::: + +</p> +</details> +<!-- markdownlint-enable MD033 --> + +The preceding Bicep is a module that provisions an Azure Cache for Redis with the following defaults: + +- `location`: The location of the Azure Cache for Redis resource. The default is the location of the resource group. +- `principalId`: The principal ID of the Azure Cache for Redis resource. +- `principalName`: The principal name of the Azure Cache for Redis resource. +- `sku`: The SKU of the Azure Cache for Redis resource. The default is `Basic` with a capacity of `1`. +- `enableNonSslPort`: The non-SSL port of the Azure Cache for Redis resource. The default is `false`. +- `disableAccessKeyAuthentication`: The access key authentication of the Azure Cache for Redis resource. The default is `true`. +- `minimumTlsVersion`: The minimum TLS version of the Azure Cache for Redis resource. The default is `1.2`. +- `redisConfiguration`: The Redis configuration of the Azure Cache for Redis resource. The default is `aad-enabled` set to `true`. +- `tags`: The tags of the Azure Cache for Redis resource. The default is `aspire-resource-name` set to the name of the Aspire resource, in this case `redis`. +- `redis_contributor`: The contributor of the Azure Cache for Redis resource, with an access policy name of `Data Contributor`. +- `connectionString`: The connection string of the Azure Cache for Redis resource. + +In addition to the Azure Cache for Redis, it also provisions an access policy assignment to the application access to the cache. The generated Bicep is a starting point and can be customized to meet your specific requirements. + +#### Customize provisioning infrastructure + +All .NET Aspire Azure resources are subclasses of the <xref:Aspire.Hosting.Azure.AzureProvisioningResource> type. This type enables the customization of the generated Bicep by providing a fluent API to configure the Azure resourcesβusing the <xref:Aspire.Hosting.AzureProvisioningResourceExtensions.ConfigureInfrastructure``1(Aspire.Hosting.ApplicationModel.IResourceBuilder{``0},System.Action{Aspire.Hosting.Azure.AzureResourceInfrastructure})> API. For example, you can configure the `kind`, `consistencyPolicy`, `locations`, and more. The following example demonstrates how to customize the Azure Cache for Redis resource: + +:::code language="csharp" source="../../snippets/azure/AppHost/Program.ConfigureRedisInfra.cs" id="configure"::: + +The preceding code: + +- Chains a call to the <xref:Aspire.Hosting.AzureProvisioningResourceExtensions.ConfigureInfrastructure*> API: + - The `infra` parameter is an instance of the <xref:Aspire.Hosting.Azure.AzureResourceInfrastructure> type. + - The provisionable resources are retrieved by calling the <xref:Azure.Provisioning.Infrastructure.GetProvisionableResources> method. + - The single <xref:Azure.Provisioning.Redis.RedisResource> is retrieved. + - The `Sku` is set with a family of `BasicOrStandard`, a name of `Standard`, and a capacity of `1`. + - A tag is added to the Redis resource with a key of `ExampleKey` and a value of `Example value`. + +There are many more configuration options available to customize the Azure Cache for Redis resource. For more information, see <xref:Azure.Provisioning.Redis>. For more information, see [Azure.Provisioning customization](../../azure/integrations-overview.md#azureprovisioning-customization). + +### Connect to an existing Azure Cache for Redis + +You might have an existing Azure Cache for Redis that you want to connect to. Instead of representing a new Azure Cache for Redis resource, you can add a connection string to the app host. To add a connection to an existing Azure Cache for Redis, call the <xref:Aspire.Hosting.ParameterResourceBuilderExtensions.AddConnectionString*> method: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var cache = builder.AddConnectionString("azure-redis"); + +builder.AddProject<Projects.WebApplication>("web") + .WithReference(cache); + +// After adding all resources, run the app... +``` + +[!INCLUDE [connection-strings-alert](../../includes/connection-strings-alert.md)] + +The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: + +```json +{ + "ConnectionStrings": { + "azure-redis": "<your-redis-name>.redis.cache.windows.net:6380,ssl=true,abortConnect=False" + } +} +``` + +The dependent resource can access the injected connection string by calling the <xref:Microsoft.Extensions.Configuration.ConfigurationExtensions.GetConnectionString*> method, and passing the connection name as the parameter, in this case `"azure-redis"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. + +### Run Azure Cache for Redis resource as a container + +The Azure Cache for Redis hosting integration supports running the Redis server as a local container. This is beneficial for situations where you want to run the Redis server locally for development and testing purposes, avoiding the need to provision an Azure resource or connect to an existing Azure Cache for Redis server. + +To make use of the [`docker.io/library/redis`](https://hub.docker.com/_/redis/) container image, and run the Azure Cache for Redis instance as a container locally, chain a call to <xref:Aspire.Hosting.AzureRedisExtensions.RunAsContainer*>, as shown in the following example: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var cache = builder.AddAzureRedis("azcache") + .RunAsContainer(); + +builder.AddProject<Projects.ExampleProject>() + .WithReference(cache); + +// After adding all resources, run the app... +``` + +The preceding code configures the Redis resource to run locally in a container. + +> [!TIP] +> The `RunAsContainer` method is useful for local development and testing. The API exposes an optional delegate that enables you to customize the underlying <xref:Aspire.Hosting.ApplicationModel.RedisResource> configuration, such adding [Redis Insights](https://redis.io/insight/), [Redis Commander](https://joeferner.github.io/redis-commander/), adding a data volume or data bind mount. For more information, see the [.NET Aspire Redis hosting integration](../stackexchange-redis-integration.md#add-redis-resource-with-redis-insights). + +### Configure the Azure Cache for Redis resource to use access key authentication + +By default, the Azure Cache for Redis resource is configured to use [Microsoft Entra ID](/azure/postgresql/flexible-server/concepts-azure-ad-authentication) authentication. If you want to use password authentication (not recommended), you can configure the server to use password authentication by calling the <xref:Aspire.Hosting.AzureRedisExtensions.WithAccessKeyAuthentication*> method: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var cache = builder.AddAzureRedis("azcache") + .WithAccessKeyAuthentication(); + +builder.AddProject<Projects.ExampleProject>() + .WithReference(cache); + +// After adding all resources, run the app... +``` + +The preceding code configures the Azure Cache for Redis resource to use access key authentication. This alters the generated Bicep to use access key authentication instead of Microsoft Entra ID authentication. In other words, the connection string will contain a password, and will be added to an Azure Key Vault secret. diff --git a/docs/caching/includes/azure-redis-client.md b/docs/caching/includes/azure-redis-client.md index 1bc347da83..27c2eb6672 100644 --- a/docs/caching/includes/azure-redis-client.md +++ b/docs/caching/includes/azure-redis-client.md @@ -2,9 +2,9 @@ ms.topic: include --- -### Add Azure Cache for Redis client +### Add Azure Cache for Redis authenticated client -By default, when you call `AddAzureRedis` in your Redis hosting integration, it configures [π¦ Microsoft.Azure.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) NuGet package to enable authentication: +By default, when you call <xref:Aspire.Hosting.AzureRedisExtensions.AddAzureRedis*> in your Redis hosting integration, it configures Microsoft Entra ID. Install the [π¦ Microsoft.Azure.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) NuGet package to enable authentication: ### [.NET CLI](#tab/dotnet-cli) diff --git a/docs/caching/includes/azure-redis-distributed-client.md b/docs/caching/includes/azure-redis-distributed-client.md index 3d766bfd86..4c2c36f50c 100644 --- a/docs/caching/includes/azure-redis-distributed-client.md +++ b/docs/caching/includes/azure-redis-distributed-client.md @@ -2,9 +2,9 @@ ms.topic: include --- -### Add Azure Cache for Redis distributed client +### Add Azure Cache for Redis authenticated distributed client -By default, when you call `AddAzureRedis` in your Redis hosting integration, it configures [π¦ Microsoft.Azure.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) NuGet package to enable authentication: +By default, when you call <xref:Aspire.Hosting.AzureRedisExtensions.AddAzureRedis*> in your app host project, the Redis hosting integration configures [π¦ Microsoft.Azure.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) NuGet package to enable authentication: ### [.NET CLI](#tab/dotnet-cli) diff --git a/docs/caching/includes/azure-redis-intro.md b/docs/caching/includes/azure-redis-intro.md new file mode 100644 index 0000000000..6c7233395d --- /dev/null +++ b/docs/caching/includes/azure-redis-intro.md @@ -0,0 +1,7 @@ +--- +ms.topic: include +--- + +[Azure Cache for Redis](/azure/azure-cache-for-redis/cache-overview) provides an in-memory data store based on the [Redis](https://redis.io/) software. Redis improves the performance and scalability of an application that uses backend data stores heavily. It's able to process large volumes of application requests by keeping frequently accessed data in the server memory, which can be written to and read from quickly. Redis brings a critical low-latency and high-throughput data storage solution to modern applications. + +Azure Cache for Redis offers both the Redis open-source (OSS Redis) and a commercial product from Redis Inc. (Redis Enterprise) as a managed service. It provides secure and dedicated Redis server instances and full Redis API compatibility. Microsoft operates the service, hosted on Azure, and usable by any application within or outside of Azure. diff --git a/docs/caching/includes/azure-redis-output-client.md b/docs/caching/includes/azure-redis-output-client.md index 91def31fa4..8a27ca241a 100644 --- a/docs/caching/includes/azure-redis-output-client.md +++ b/docs/caching/includes/azure-redis-output-client.md @@ -2,9 +2,9 @@ ms.topic: include --- -### Add Azure Cache for Redis output client +### Add Azure Cache for Redis authenticated output client -By default, when you call `AddAzureRedis` in your Redis hosting integration, it configures [π¦ Microsoft.Azure.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) NuGet package to enable authentication: +By default, when you call <xref:Aspire.Hosting.AzureRedisExtensions.AddAzureRedis*> in your Redis hosting integration, it configures [π¦ Microsoft.Azure.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) NuGet package to enable authentication: ### [.NET CLI](#tab/dotnet-cli) diff --git a/docs/caching/includes/redis-app-host.md b/docs/caching/includes/redis-app-host.md index 88d5a1fbf5..16c52caac1 100644 --- a/docs/caching/includes/redis-app-host.md +++ b/docs/caching/includes/redis-app-host.md @@ -2,7 +2,7 @@ ms.topic: include --- -The Redis hosting integration models a Redis resource as the <xref:Aspire.Hosting.ApplicationModel.RedisResource> type. To access this type and APIs that allow you to add it to your [π¦ Aspire.Hosting.Redis](https://www.nuget.org/packages/Aspire.Hosting.Redis) NuGet package in the [app host](xref:dotnet/aspire/app-host) project. +The Redis hosting integration models a Redis resource as the <xref:Aspire.Hosting.ApplicationModel.RedisResource> type. To access this type and APIs for expressing them as resources in your [app host](xref:dotnet/aspire/app-host) project, add the [π¦ Aspire.Hosting.Redis](https://www.nuget.org/packages/Aspire.Hosting.Redis) NuGet package: ### [.NET CLI](#tab/dotnet-cli) diff --git a/docs/caching/includes/redis-client-health-checks-and-diagnostics.md b/docs/caching/includes/redis-client-health-checks-and-diagnostics.md new file mode 100644 index 0000000000..032f82dd4a --- /dev/null +++ b/docs/caching/includes/redis-client-health-checks-and-diagnostics.md @@ -0,0 +1,28 @@ +--- +ms.topic: include +--- + +[!INCLUDE [client-integration-health-checks](../../includes/client-integration-health-checks.md)] + +The .NET Aspire Stack Exchange Redis integration handles the following: + +- Adds the health check when <xref:Aspire.StackExchange.Redis.StackExchangeRedisSettings.DisableHealthChecks?displayProperty=nameWithType> is `false`, which attempts to connect to the container instance. +- Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic. + +[!INCLUDE [integration-observability-and-telemetry](../../includes/integration-observability-and-telemetry.md)] + +#### Logging + +The .NET Aspire Stack Exchange Redis integration uses the following log categories: + +- `Aspire.StackExchange.Redis` + +#### Tracing + +The .NET Aspire Stack Exchange Redis integration will emit the following tracing activities using OpenTelemetry: + +- `OpenTelemetry.Instrumentation.StackExchangeRedis` + +#### Metrics + +The .NET Aspire Stack Exchange Redis integration currently doesn't support metrics by default due to limitations with the `StackExchange.Redis` library. diff --git a/docs/caching/includes/redis-client-json-settings.md b/docs/caching/includes/redis-client-json-settings.md index c17354d0ae..579f54bb17 100644 --- a/docs/caching/includes/redis-client-json-settings.md +++ b/docs/caching/includes/redis-client-json-settings.md @@ -9,7 +9,10 @@ The .NET Aspire Stack Exchange Redis integration supports <xref:Microsoft.Extens "Aspire": { "StackExchange": { "Redis": { - "ConnectionString": "localhost:6379", + "ConfigurationOptions": { + "ConnectTimeout": 3000, + "ConnectRetry": 2 + }, "DisableHealthChecks": true, "DisableTracing": false } diff --git a/docs/caching/includes/redis-client-nuget.md b/docs/caching/includes/redis-client-nuget.md new file mode 100644 index 0000000000..98c7f913af --- /dev/null +++ b/docs/caching/includes/redis-client-nuget.md @@ -0,0 +1,20 @@ +--- +ms.topic: include +--- + +To get started with the .NET Aspire Stack Exchange Redis client integration, install the [π¦ Aspire.StackExchange.Redis](https://www.nuget.org/packages/Aspire.StackExchange.Redis) NuGet package in the client-consuming project, that is, the project for the application that uses the Redis client. The Redis client integration registers an [IConnectionMultiplexer](https://stackexchange.github.io/StackExchange.Redis/Basics) instance that you can use to interact with Redis. + +### [.NET CLI](#tab/dotnet-cli) + +```dotnetcli +dotnet add package Aspire.StackExchange.Redis +``` + +### [PackageReference](#tab/package-reference) + +```xml +<PackageReference Include="Aspire.StackExchange.Redis" + Version="*" /> +``` + +--- diff --git a/docs/caching/includes/redis-distributed-client-health-checks-and-diagnostics.md b/docs/caching/includes/redis-distributed-client-health-checks-and-diagnostics.md new file mode 100644 index 0000000000..6ceed112cc --- /dev/null +++ b/docs/caching/includes/redis-distributed-client-health-checks-and-diagnostics.md @@ -0,0 +1,29 @@ +--- +ms.topic: include +--- + +[!INCLUDE [client-integration-health-checks](../../includes/client-integration-health-checks.md)] + +The .NET Aspire Redis distributed caching integration handles the following: + +- Adds the health check when <xref:Aspire.StackExchange.Redis.StackExchangeRedisSettings.DisableHealthChecks?displayProperty=nameWithType> is `false`, which attempts to connect to the container instance. +- Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic. + +[!INCLUDE [integration-observability-and-telemetry](../../includes/integration-observability-and-telemetry.md)] + +#### Logging + +The .NET Aspire Redis distributed caching integration uses the following Log categories: + +- `Aspire.StackExchange.Redis` +- `Microsoft.Extensions.Caching.StackExchangeRedis` + +#### Tracing + +The .NET Aspire Redis distributed caching integration will emit the following Tracing activities using OpenTelemetry: + +- `OpenTelemetry.Instrumentation.StackExchangeRedis` + +#### Metrics + +The .NET Aspire Redis Distributed caching integration currently doesn't support metrics by default due to limitations with the `StackExchange.Redis` library. diff --git a/docs/caching/includes/redis-distributed-client-json-settings.md b/docs/caching/includes/redis-distributed-client-json-settings.md new file mode 100644 index 0000000000..a58f65609c --- /dev/null +++ b/docs/caching/includes/redis-distributed-client-json-settings.md @@ -0,0 +1,24 @@ +--- +ms.topic: include +--- + +The .NET Aspire Stack Exchange Redis distributed caching integration supports <xref:Microsoft.Extensions.Configuration?displayProperty=fullName>. It loads the <xref:Aspire.StackExchange.Redis.StackExchangeRedisSettings> from configuration by using the `Aspire:StackExchange:Redis` key. Example _:::no-loc text="appsettings.json":::_ that configures some of the options: + +```json +{ + "Aspire": { + "StackExchange": { + "Redis": { + "ConfigurationOptions": { + "ConnectTimeout": 3000, + "ConnectRetry": 2 + }, + "DisableHealthChecks": true, + "DisableTracing": false + } + } + } +} +``` + +For the complete Redis distributed caching client integration JSON schema, see [Aspire.StackExchange.Redis.DistributedCaching/ConfigurationSchema.json](https://github.com/dotnet/aspire/blob/v9.0.0/src/Components/Aspire.StackExchange.Redis.DistributedCaching/ConfigurationSchema.json). diff --git a/docs/caching/includes/redis-distributed-client-nuget.md b/docs/caching/includes/redis-distributed-client-nuget.md new file mode 100644 index 0000000000..9db64ff763 --- /dev/null +++ b/docs/caching/includes/redis-distributed-client-nuget.md @@ -0,0 +1,20 @@ +--- +ms.topic: include +--- + +To get started with the .NET Aspire Redis distributed caching integration, install the [π¦ Aspire.StackExchange.Redis.DistributedCaching](https://www.nuget.org/packages/Aspire.StackExchange.Redis.DistributedCaching) NuGet package in the client-consuming project, i.e., the project for the application that uses the Redis distributed caching client. The Redis client integration registers an <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> instance that you can use to interact with Redis. + +### [.NET CLI](#tab/dotnet-cli) + +```dotnetcli +dotnet add package Aspire.StackExchange.Redis.DistributedCaching +``` + +### [PackageReference](#tab/package-reference) + +```xml +<PackageReference Include="Aspire.StackExchange.Redis.DistributedCaching" + Version="*" /> +``` + +--- diff --git a/docs/caching/includes/redis-output-client-health-checks-and-diagnostics.md b/docs/caching/includes/redis-output-client-health-checks-and-diagnostics.md new file mode 100644 index 0000000000..3cfb8f2325 --- /dev/null +++ b/docs/caching/includes/redis-output-client-health-checks-and-diagnostics.md @@ -0,0 +1,29 @@ +--- +ms.topic: include +--- + +[!INCLUDE [client-integration-health-checks](../../includes/client-integration-health-checks.md)] + +The .NET Aspire Stack Exchange Redis output caching integration handles the following: + +- Adds the health check when <xref:Aspire.StackExchange.Redis.StackExchangeRedisSettings.DisableHealthChecks?displayProperty=nameWithType> is `false`, which attempts to connect to the container instance. +- Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic. + +[!INCLUDE [integration-observability-and-telemetry](../../includes/integration-observability-and-telemetry.md)] + +#### Logging + +The .NET Aspire Stack Exchange Redis output caching integration uses the following Log categories: + +- `Aspire.StackExchange.Redis` +- `Microsoft.AspNetCore.OutputCaching.StackExchangeRedis` + +#### Tracing + +The .NET Aspire Stack Exchange Redis output caching integration will emit the following Tracing activities using OpenTelemetry: + +- `OpenTelemetry.Instrumentation.StackExchangeRedis` + +#### Metrics + +The .NET Aspire Stack Exchange Redis output caching integration currently doesn't support metrics by default due to limitations with the `StackExchange.Redis` library. diff --git a/docs/caching/includes/redis-output-client-json-settings.md b/docs/caching/includes/redis-output-client-json-settings.md new file mode 100644 index 0000000000..af2ec24492 --- /dev/null +++ b/docs/caching/includes/redis-output-client-json-settings.md @@ -0,0 +1,24 @@ +--- +ms.topic: include +--- + +The .NET Aspire Stack Exchange Redis output caching integration supports <xref:Microsoft.Extensions.Configuration?displayProperty=fullName>. It loads the <xref:Aspire.StackExchange.Redis.StackExchangeRedisSettings> from configuration by using the `Aspire:StackExchange:Redis` key. Example _:::no-loc text="appsettings.json":::_ that configures some of the options: + +```json +{ + "Aspire": { + "StackExchange": { + "Redis": { + "ConfigurationOptions": { + "ConnectTimeout": 3000, + "ConnectRetry": 2 + }, + "DisableHealthChecks": true, + "DisableTracing": false + } + } + } +} +``` + +For the complete Redis output caching client integration JSON schema, see [Aspire.StackExchange.Redis.OutputCaching/ConfigurationSchema.json](https://github.com/dotnet/aspire/blob/v9.0.0/src/Components/Aspire.StackExchange.Redis.OutputCaching/ConfigurationSchema.json). diff --git a/docs/caching/includes/redis-output-client-nuget.md b/docs/caching/includes/redis-output-client-nuget.md new file mode 100644 index 0000000000..d167b97086 --- /dev/null +++ b/docs/caching/includes/redis-output-client-nuget.md @@ -0,0 +1,20 @@ +--- +ms.topic: include +--- + +To get started with the .NET Aspire Stack Exchange Redis output caching client integration, install the [π¦ Aspire.StackExchange.Redis.OutputCaching](https://www.nuget.org/packages/Aspire.StackExchange.Redis.OutputCaching) NuGet package in the client-consuming project, that is, the project for the application that uses the output caching client. The Redis output caching client integration registers services required for enabling <xref:Microsoft.Extensions.DependencyInjection.OutputCacheConventionBuilderExtensions.CacheOutput*> method calls and [[OutputCache]](xref:Microsoft.AspNetCore.OutputCaching.OutputCacheAttribute) attribute usage to rely on Redis as its caching mechanism. + +### [.NET CLI](#tab/dotnet-cli) + +```dotnetcli +dotnet add package Aspire.StackExchange.Redis.OutputCaching +``` + +### [PackageReference](#tab/package-reference) + +```xml +<PackageReference Include="Aspire.StackExchange.Redis.OutputCache" + Version="*" /> +``` + +--- diff --git a/docs/caching/stackexchange-redis-caching-overview.md b/docs/caching/stackexchange-redis-caching-overview.md index d5e2f85222..e4577145df 100644 --- a/docs/caching/stackexchange-redis-caching-overview.md +++ b/docs/caching/stackexchange-redis-caching-overview.md @@ -1,7 +1,7 @@ --- title: Stack Exchange Redis caching overview description: Learn about Stack Exchange Redis caching and how to use it in your applications. -ms.date: 11/05/2024 +ms.date: 02/05/2025 --- # Stack Exchange Redis®<sup>**[*](#registered)**</sup> caching overview @@ -21,11 +21,11 @@ In addition to Redis itself, there are two well-maintained implementations of RE - [Garnet](https://github.com/microsoft/Garnet): Garnet is a remote cache-store from Microsoft Research that offers strong performance (throughput and latency), scalability, storage, recovery, cluster sharding, key migration, and replication features. Garnet can work with existing Redis clients. - [Valkey](https://github.com/valkey-io/valkey): A flexible distributed key-value datastore that supports both caching and beyond caching workloads. -.NET Aspire lets you easily model either the Redis, Garnet, or Valkey RESP protocol in your applications and you can choose which one to use based on your requirements. All of the .NET Aspire Redis integrations can be used with either the Redis, Garnet, or Valkey RESP protocol. +.NET Aspire lets you easily choose either the Redis, Garnet, or Valkey RESP protocol in your applications based on your requirements. All of the .NET Aspire Redis client integrations can be used with either the Redis, Garnet, or Valkey RESP protocol. ## Caching -Caching is a technique used to store frequently accessed data in memory. This helps to reduce the time it takes to retrieve the data from the original source, such as a database or a web service. Caching can significantly improve the performance of an application by reducing the number of requests made to the original source. To access the Redis `IConnectionMultiplexer` object, you use the `Aspire.StackExchange.Redis` NuGet package: +Caching is a technique used to store frequently accessed data in memory. This helps to reduce the time it takes to retrieve the data from the original source, such as a database or a web service. Caching can significantly improve the performance of an application by reducing the number of requests made to the original source. To access the Redis [IConnectionMultiplexer](https://stackexchange.github.io/StackExchange.Redis/Basics.html) object, you use the [π¦ Aspire.StackExchange.Redis](https://www.nuget.org/packages/Aspire.StackExchange.Redis) NuGet package: > [!div class="nextstepaction"] > [.NET Aspire Stack Exchange Redis integration](stackexchange-redis-integration.md) @@ -38,7 +38,7 @@ Caching is a technique used to store frequently accessed data in memory. This he ## Distributed caching -Distributed caching is a type of caching that stores data across multiple servers. This allows the data to be shared between multiple instances of an application, which can help to improve scalability and performance. Distributed caching can be used to store a wide variety of data, such as session state, user profiles, and frequently accessed data. To use Redis distributed caching in your application (the `IDistributedCache` interface), use the `Aspire.StackExchange.Redis.DistributedCaching` NuGet package: +Distributed caching is a type of caching that stores data across multiple servers. This allows the data to be shared between multiple instances of an application, which can help to improve scalability and performance. Distributed caching can be used to store a wide variety of data, such as session state, user profiles, and frequently accessed data. To use Redis distributed caching in your application (the <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> interface), use the [π¦ Aspire.StackExchange.Redis.DistributedCaching](https://www.nuget.org/packages/Aspire.StackExchange.Redis.DistributedCaching) NuGet package: > [!div class="nextstepaction"] > [.NET Aspire Stack Exchange Redis distributed caching integration](stackexchange-redis-distributed-caching-integration.md) @@ -51,7 +51,7 @@ Distributed caching is a type of caching that stores data across multiple server ## Output caching -Output caching is a type of caching that stores the output of a web page or API response. This allows the response to be served directly from the cache, rather than generating it from scratch each time. Output caching can help to improve the performance of a web application by reducing the time it takes to generate a response. To use declarative Redis output caching with either the `OutputCache` attribute or the `CacheOutput` method in your application, use the `Aspire.StackExchange.Redis.OutputCaching` NuGet package: +Output caching is a type of caching that stores the output of a web page or API response. This allows the response to be served directly from the cache, rather than generating it from scratch each time. Output caching can help to improve the performance of a web application by reducing the time it takes to generate a response. To use declarative Redis output caching with either the <xref:Microsoft.AspNetCore.OutputCaching.OutputCacheAttribute> or the <xref:Microsoft.Extensions.DependencyInjection.OutputCacheConventionBuilderExtensions.CacheOutput*> method in your application, use the [π¦ Aspire.StackExchange.Redis.OutputCaching`](https://www.nuget.org/packages/Aspire.StackExchange.Redis.OutputCaching`) NuGet package: > [!div class="nextstepaction"] > [.NET Aspire Stack Exchange Redis output caching integration](stackexchange-redis-output-caching-integration.md) diff --git a/docs/caching/stackexchange-redis-distributed-caching-integration.md b/docs/caching/stackexchange-redis-distributed-caching-integration.md index 48c8e98787..fada24401f 100644 --- a/docs/caching/stackexchange-redis-distributed-caching-integration.md +++ b/docs/caching/stackexchange-redis-distributed-caching-integration.md @@ -1,7 +1,7 @@ --- title: .NET Aspire Redis distributed caching integration description: Learn how to use the .NET Aspire Redis distributed caching integration, which includes both hosting and client integrations. -ms.date: 11/05/2024 +ms.date: 02/05/2025 zone_pivot_groups: resp-host --- @@ -51,22 +51,7 @@ Learn how to use the .NET Aspire Redis distributed caching integration. The `Asp ## Client integration -To get started with the .NET Aspire Redis distributed caching integration, install the [π¦ Aspire.StackExchange.Redis.DistributedCaching](https://www.nuget.org/packages/Aspire.StackExchange.Redis.DistributedCaching) NuGet package in the client-consuming project, i.e., the project for the application that uses the Redis distributed caching client. - -### [.NET CLI](#tab/dotnet-cli) - -```dotnetcli -dotnet add package Aspire.StackExchange.Redis.DistributedCaching -``` - -### [PackageReference](#tab/package-reference) - -```xml -<PackageReference Include="Aspire.StackExchange.Redis.DistributedCaching" - Version="*" /> -``` - ---- +[!INCLUDE [redis-distributed-client-nuget](includes/redis-distributed-client-nuget.md)] ### Add Redis client @@ -154,7 +139,7 @@ For more information on how to format this connection string, see the [Stack Exc #### Use configuration providers -[!INCLUDE [redis-client-json-settings](includes/redis-client-json-settings.md)] +[!INCLUDE [redis-distributed-client-json-settings](includes/redis-distributed-client-json-settings.md)] #### Use inline delegates @@ -174,39 +159,7 @@ builder.AddRedisDistributedCache( static settings => settings.ConnectTimeout = 3_000); ``` -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] - -The .NET Aspire Redis distributed caching integration handles the following: - -- Adds the `StackExchange.Redis` health check, tries to open the connection and throws when it fails. -- Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic - -[!INCLUDE [integration-observability-and-telemetry](../includes/integration-observability-and-telemetry.md)] - -#### Logging - -The .NET Aspire Redis Distributed Caching integration uses the following Log categories: - -- `Aspire.StackExchange.Redis` -- `Microsoft.Extensions.Caching.StackExchangeRedis` - -#### Tracing - -The .NET Aspire Redis Distributed Caching integration will emit the following Tracing activities using OpenTelemetry: - -- `OpenTelemetry.Instrumentation.StackExchangeRedis` - -#### Metrics - -The .NET Aspire Redis Distributed Caching integration currently doesn't support metrics by default due to limitations with the `StackExchange.Redis` library. - -:::zone pivot="redis" - -[!INCLUDE [azure-redis-app-host](includes/azure-redis-app-host.md)] - -[!INCLUDE [azure-redis-distributed-client](includes/azure-redis-distributed-client.md)] - -:::zone-end +[!INCLUDE [redis-distributed-client-health-checks-and-diagnostics](includes/redis-distributed-client-health-checks-and-diagnostics.md)] ## See also diff --git a/docs/caching/stackexchange-redis-integration.md b/docs/caching/stackexchange-redis-integration.md index 3272d0cbdf..d7f0077160 100644 --- a/docs/caching/stackexchange-redis-integration.md +++ b/docs/caching/stackexchange-redis-integration.md @@ -1,7 +1,7 @@ --- title: .NET Aspire Redis integration description: Learn how to use the .NET Aspire Redis integration, which includes both hosting and client integrations. -ms.date: 11/05/2024 +ms.date: 02/05/2025 zone_pivot_groups: resp-host --- @@ -51,22 +51,7 @@ zone_pivot_groups: resp-host ## Client integration -To get started with the .NET Aspire Stack Exchange Redis client integration, install the [π¦ Aspire.StackExchange.Redis](https://www.nuget.org/packages/Aspire.StackExchange.Redis) NuGet package in the client-consuming project, that is, the project for the application that uses the Redis client. The Redis client integration registers an an [IConnectionMultiplexer](https://stackexchange.github.io/StackExchange.Redis/Basics) instance that you can use to interact with Redis. - -### [.NET CLI](#tab/dotnet-cli) - -```dotnetcli -dotnet add package Aspire.StackExchange.Redis -``` - -### [PackageReference](#tab/package-reference) - -```xml -<PackageReference Include="Aspire.StackExchange.Redis" - Version="*" /> -``` - ---- +[!INCLUDE [redis-client-nuget](includes/redis-client-nuget.md)] ### Add Redis client @@ -188,42 +173,7 @@ builder.AddRedisClient( static settings => settings.DisableTracing = true); ``` -### Client integration health checks - -By default, .NET Aspire integrations enable [health checks](../fundamentals/health-checks.md) for all services. For more information, see [.NET Aspire integrations overview](../fundamentals/integrations-overview.md). - -The .NET Aspire Stack Exchange Redis integration handles the following: - -- Adds the health check when <xref:Aspire.StackExchange.Redis.StackExchangeRedisSettings.DisableHealthChecks?displayProperty=nameWithType> is `false`, which attempts to connect to the container instance. -- Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic. - -### Observability and telemetry - -.NET Aspire integrations automatically set up Logging, Tracing, and Metrics configurations, which are sometimes known as *the pillars of observability*. For more information about integration observability and telemetry, see [.NET Aspire integrations overview](../fundamentals/integrations-overview.md). Depending on the backing service, some integrations might only support some of these features. For example, some integrations support logging and tracing, but not metrics. Telemetry features can also be disabled using the techniques presented in the [Configuration](#configuration) section. - -#### Logging - -The .NET Aspire Stack Exchange Redis integration uses the following log categories: - -- `Aspire.StackExchange.Redis` - -#### Tracing - -The .NET Aspire Stack Exchange Redis integration will emit the following tracing activities using OpenTelemetry: - -- `OpenTelemetry.Instrumentation.StackExchangeRedis` - -#### Metrics - -The .NET Aspire Stack Exchange Redis integration currently doesn't support metrics by default due to limitations with the `StackExchange.Redis` library. - -:::zone pivot="redis" - -[!INCLUDE [azure-redis-app-host](includes/azure-redis-app-host.md)] - -[!INCLUDE [azure-redis-client](includes/azure-redis-client.md)] - -:::zone-end +[!INCLUDE [redis-client-health-checks-and-diagnostics](includes/redis-client-health-checks-and-diagnostics.md)] ## See also diff --git a/docs/caching/stackexchange-redis-output-caching-integration.md b/docs/caching/stackexchange-redis-output-caching-integration.md index c372c42422..ca75dba798 100644 --- a/docs/caching/stackexchange-redis-output-caching-integration.md +++ b/docs/caching/stackexchange-redis-output-caching-integration.md @@ -1,7 +1,7 @@ --- title: .NET Aspire Redis output caching integration description: Learn how to use the .NET Aspire Redis output caching integration to register an ASP.NET Core Output Caching provider backed by a Redis server. -ms.date: 11/05/2024 +ms.date: 02/05/2025 zone_pivot_groups: resp-host --- @@ -51,22 +51,7 @@ Learn how to use the .NET Aspire Redis output caching integration. The `Aspire.S ## Client integration -To get started with the .NET Aspire Stack Exchange Redis output caching client integration, install the [π¦ Aspire.StackExchange.Redis.OutputCaching](https://www.nuget.org/packages/Aspire.StackExchange.Redis.OutputCaching) NuGet package in the client-consuming project, that is, the project for the application that uses the output caching client. - -### [.NET CLI](#tab/dotnet-cli) - -```dotnetcli -dotnet add package Aspire.StackExchange.Redis.OutputCaching -``` - -### [PackageReference](#tab/package-reference) - -```xml -<PackageReference Include="Aspire.StackExchange.Redis.OutputCache" - Version="*" /> -``` - ---- +[!INCLUDE [redis-output-client-nuget](includes/redis-output-client-nuget.md)] ### Add output caching @@ -142,7 +127,7 @@ For more information on how to format this connection string, see the [Stack Exc #### Use configuration providers -[!INCLUDE [redis-client-json-settings](includes/redis-client-json-settings.md)] +[!INCLUDE [redis-output-client-json-settings](includes/redis-output-client-json-settings.md)] #### Use inline delegates @@ -162,39 +147,7 @@ builder.AddRedisOutputCache( static settings => settings.ConnectTimeout = 3_000); ``` -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] - -The .NET Aspire Stack Exchange Redis output caching integration handles the following: - -- Adds the `StackExchange.Redis` health check, tries to open the connection and throws when it fails. -- Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic. - -[!INCLUDE [integration-observability-and-telemetry](../includes/integration-observability-and-telemetry.md)] - -#### Logging - -The .NET Aspire Stack Exchange Redis output caching integration uses the following Log categories: - -- `Aspire.StackExchange.Redis` -- `Microsoft.AspNetCore.OutputCaching.StackExchangeRedis` - -#### Tracing - -The .NET Aspire Stack Exchange Redis output caching integration will emit the following Tracing activities using OpenTelemetry: - -- `OpenTelemetry.Instrumentation.StackExchangeRedis` - -#### Metrics - -The .NET Aspire Stack Exchange Redis output caching integration currently doesn't support metrics by default due to limitations with the `StackExchange.Redis` library. - -:::zone pivot="redis" - -[!INCLUDE [azure-redis-app-host](includes/azure-redis-app-host.md)] - -[!INCLUDE [azure-redis-output-client](includes/azure-redis-output-client.md)] - -:::zone-end +[!INCLUDE [redis-output-client-health-checks-and-diagnostics](includes/redis-output-client-health-checks-and-diagnostics.md)] ## See also diff --git a/docs/database/includes/postgresql-client.md b/docs/database/includes/postgresql-client.md index 6dd96118cd..878314a75b 100644 --- a/docs/database/includes/postgresql-client.md +++ b/docs/database/includes/postgresql-client.md @@ -117,7 +117,7 @@ builder.AddNpgsqlDataSource( static settings => settings.DisableHealthChecks = true); ``` -[!INCLUDE [integration-health-checks](../../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../../includes/client-integration-health-checks.md)] - Adds the [`NpgSqlHealthCheck`](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/src/HealthChecks.NpgSql/NpgSqlHealthCheck.cs), which verifies that commands can be successfully executed against the underlying Postgres database. - Integrates with the `/health` HTTP endpoint, which specifies all registered health checks must pass for app to be considered ready to accept traffic diff --git a/docs/database/includes/postgresql-ef-client.md b/docs/database/includes/postgresql-ef-client.md index a2625df091..0c55168224 100644 --- a/docs/database/includes/postgresql-ef-client.md +++ b/docs/database/includes/postgresql-ef-client.md @@ -147,7 +147,7 @@ Then calling the <xref:Microsoft.Extensions.Hosting.AspireEFPostgreSqlExtensions builder.AddNpgsqlDbContext<AnotherDbContext>(); ``` -[!INCLUDE [integration-health-checks](../../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../../includes/client-integration-health-checks.md)] By default, the .NET Aspire PostgreSQL Entity Framework Core integrations handles the following: diff --git a/docs/database/includes/postgresql-flexible-server.md b/docs/database/includes/postgresql-flexible-server.md index dc356c79fa..8a101852a1 100644 --- a/docs/database/includes/postgresql-flexible-server.md +++ b/docs/database/includes/postgresql-flexible-server.md @@ -55,123 +55,3 @@ The preceding call to `AddAzurePostgresFlexibleServer` configures the PostgresSQ > [!TIP] > When you call <xref:Aspire.Hosting.AzurePostgresExtensions.AddAzurePostgresFlexibleServer*>, it implicitly calls <xref:Aspire.Hosting.AzureProvisionerExtensions.AddAzureProvisioning*>βwhich adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see [Local provisioning: Configuration](../../azure/local-provisioning.md#configuration). - -#### Generated provisioning Bicep - -If you're new to [Bicep](/azure/azure-resource-manager/bicep/overview), it's a domain-specific language for defining Azure resources. With .NET Aspire, you don't need to write Bicep by-hand, instead the provisioning APIs generate Bicep for you. When you publish your app, the generated Bicep is output alongside the manifest file. When you add an Azure PostgreSQL resource, the following Bicep is generated: - -<!-- markdownlint-disable MD033 --> -<br/> -<details> -<summary id="azure-postgresql"><strong>Toggle Azure PostgreSQL Bicep.</strong></summary> -<p aria-labelledby="azure-postgresql"> - -:::code language="bicep" source="../../snippets/azure/AppHost/postgres-flexible.module.bicep"::: - -</p> -</details> -<!-- markdownlint-enable MD033 --> - -The preceding Bicep is a module that provisions an Azure PostgreSQL flexible server with the following defaults: - -- `authConfig`: The authentication configuration of the PostgreSQL server. The default is `ActiveDirectoryAuth` enabled and `PasswordAuth` disabled. -- `availabilityZone`: The availability zone of the PostgreSQL server. The default is `1`. -- `backup`: The backup configuration of the PostgreSQL server. The default is `BackupRetentionDays` set to `7` and `GeoRedundantBackup` set to `Disabled`. -- `highAvailability`: The high availability configuration of the PostgreSQL server. The default is `Disabled`. -- `storage`: The storage configuration of the PostgreSQL server. The default is `StorageSizeGB` set to `32`. -- `version`: The version of the PostgreSQL server. The default is `16`. -- `sku`: The SKU of the PostgreSQL server. The default is `Standard_B1ms`. -- `tags`: The tags of the PostgreSQL server. The default is `aspire-resource-name` set to the name of the Aspire resource, in this case `postgres-flexible`. - -In addition to the PostgreSQL flexible server, it also provisions an Azure Firewall rule to allow all Azure IP addresses. Finally, an administrator is created for the PostgreSQL server, and the connection string is outputted as an output variable. The generated Bicep is a starting point and can be customized to meet your specific requirements. - -#### Customize provisioning infrastructure - -All .NET Aspire Azure resources are subclasses of the <xref:Aspire.Hosting.Azure.AzureProvisioningResource> type. This type enables the customization of the generated Bicep by providing a fluent API to configure the Azure resourcesβusing the <xref:Aspire.Hosting.AzureProvisioningResourceExtensions.ConfigureInfrastructure``1(Aspire.Hosting.ApplicationModel.IResourceBuilder{``0},System.Action{Aspire.Hosting.Azure.AzureResourceInfrastructure})> API. For example, you can configure the `kind`, `consistencyPolicy`, `locations`, and more. The following example demonstrates how to customize the Azure Cosmos DB resource: - -:::code language="csharp" source="../../snippets/azure/AppHost/Program.ConfigurePostgresSQLInfra.cs" id="configure"::: - -The preceding code: - -- Chains a call to the <xref:Aspire.Hosting.AzureProvisioningResourceExtensions.ConfigureInfrastructure*> API: - - The `infra` parameter is an instance of the <xref:Aspire.Hosting.Azure.AzureResourceInfrastructure> type. - - The provisionable resources are retrieved by calling the <xref:Azure.Provisioning.Infrastructure.GetProvisionableResources> method. - - The single <xref:Azure.Provisioning.PostgreSql.PostgreSqlFlexibleServer> is retrieved. - - The `sku` is set with <xref:Azure.Provisioning.PostgreSql.PostgreSqlFlexibleServerSkuTier.Burstable?displayProperty=nameWithType>. - - The high availability properties are set with <xref:Azure.Provisioning.PostgreSql.PostgreSqlFlexibleServerHighAvailabilityMode.ZoneRedundant?displayProperty=nameWithType> in standby availability zone `"2"`. - - A tag is added to the flexible server with a key of `ExampleKey` and a value of `Example value`. - -There are many more configuration options available to customize the PostgreSQL flexible server resource. For more information, see <xref:Azure.Provisioning.PostgreSql>. For more information, see [Azure.Provisioning customization](../../azure/integrations-overview.md#azureprovisioning-customization). - -### Connect to an existing Azure PostgreSQL flexible server - -You might have an existing Azure PostgreSQL flexible server that you want to connect to. Instead of representing a new Azure PostgreSQL flexible server resource, you can add a connection string to the app host. To add a connection to an existing Azure PostgreSQL flexible server, call the <xref:Aspire.Hosting.ParameterResourceBuilderExtensions.AddConnectionString*> method: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var postgres = builder.AddConnectionString("postgres"); - -builder.AddProject<Projects.WebApplication>("web") - .WithReference(postgres); - -// After adding all resources, run the app... -``` - -[!INCLUDE [connection-strings-alert](../../includes/connection-strings-alert.md)] - -The connection string is configured in the app host's configuration, typically under [User Secrets](/aspnet/core/security/app-secrets), under the `ConnectionStrings` section. The app host injects this connection string as an environment variable into all dependent resources, for example: - -```json -{ - "ConnectionStrings": { - "postgres": "Server=<PostgreSQL-server-name>.postgres.database.azure.com;Database=<database-name>;Port=5432;Ssl Mode=Require;User Id=<username>;" - } -} -``` - -The dependent resource can access the injected connection string by calling the <xref:Microsoft.Extensions.Configuration.ConfigurationExtensions.GetConnectionString*> method, and passing the connection name as the parameter, in this case `"postgres"`. The `GetConnectionString` API is shorthand for `IConfiguration.GetSection("ConnectionStrings")[name]`. - -### Run Azure PostgreSQL resource as a container - -The Azure PostgreSQL hosting integration supports running the PostgreSQL server as a local container. This is beneficial for situations where you want to run the PostgreSQL server locally for development and testing purposes, avoiding the need to provision an Azure resource or connect to an existing Azure PostgreSQL server. - -To run the PostgreSQL server as a container, call the <xref:Aspire.Hosting.AzurePostgresExtensions.RunAsContainer*> method: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var postgres = builder.AddAzurePostgresFlexibleServer("postgres") - .RunAsContainer(); - -var postgresdb = postgres.AddDatabase("postgresdb"); - -var exampleProject = builder.AddProject<Projects.ExampleProject>() - .WithReference(postgresdb); -``` - -The preceding code configures an Azure PostgreSQL Flexible Server resource to run locally in a container. - -> [!TIP] -> The `RunAsContainer` method is useful for local development and testing. The API exposes an optional delegate that enables you to customize the underlying <xref:Aspire.Hosting.ApplicationModel.PostgresServerResource> configuration, such adding pgAdmin, pgWeb, adding a data volume or data bind mount, and adding an init bind mount. For more information, see the [.NET Aspire PostgreSQL hosting integration](../postgresql-integration.md#add-postgresql-pgadmin-resource) section. - -### Configure the Azure PostgreSQL server to use password authentication - -By default, the Azure PostgreSQL server is configured to use [Microsoft Entra ID](/azure/postgresql/flexible-server/concepts-azure-ad-authentication) authentication. If you want to use password authentication, you can configure the server to use password authentication by calling the <xref:Aspire.Hosting.AzurePostgresExtensions.WithPasswordAuthentication*> method: - -```csharp -var builder = DistributedApplication.CreateBuilder(args); - -var username = builder.AddParameter("username", secret: true); -var password = builder.AddParameter("password", secret: true); - -var postgres = builder.AddAzurePostgresFlexibleServer("postgres") - .WithPasswordAuthentication(username, password); - -var postgresdb = postgres.AddDatabase("postgresdb"); - -var exampleProject = builder.AddProject<Projects.ExampleProject>() - .WithReference(postgresdb); -``` - -The preceding code configures the Azure PostgreSQL server to use password authentication. The `username` and `password` parameters are added to the app host as parameters, and the `WithPasswordAuthentication` method is called to configure the Azure PostgreSQL server to use password authentication. For more information, see [External parameters](../../fundamentals/external-parameters.md). diff --git a/docs/database/mongodb-integration.md b/docs/database/mongodb-integration.md index b329ff2600..bf3097138c 100644 --- a/docs/database/mongodb-integration.md +++ b/docs/database/mongodb-integration.md @@ -340,7 +340,7 @@ Here are the configurable options with corresponding default values: | `HealthCheckTimeout` | An `int?` value that indicates the MongoDB health check timeout in milliseconds. | | `DisableTracing` | A boolean value that indicates whether the OpenTelemetry tracing is disabled or not. | -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] By default, the .NET Aspire MongoDB client integration handles the following scenarios: diff --git a/docs/database/mysql-entity-framework-integration.md b/docs/database/mysql-entity-framework-integration.md index 061f5ee780..7193110713 100644 --- a/docs/database/mysql-entity-framework-integration.md +++ b/docs/database/mysql-entity-framework-integration.md @@ -140,7 +140,7 @@ builder.EnrichMySqlDbContext<MyDbContext>( static settings => settings.DisableHealthChecks = true); ``` -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] The .NET Aspire Pomelo MySQL Entity Framework Core integration: diff --git a/docs/database/oracle-entity-framework-integration.md b/docs/database/oracle-entity-framework-integration.md index 5f4a211fb5..a787e02c61 100644 --- a/docs/database/oracle-entity-framework-integration.md +++ b/docs/database/oracle-entity-framework-integration.md @@ -280,7 +280,7 @@ Here are the configurable options with corresponding default values: | `DisableRetry` | A boolean value that indicates whether command retries should be disabled or not. | | `CommandTimeout` | The time in seconds to wait for the command to execute. | -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] By default, the .NET Aspire Oracle Entity Framework Core integration handles the following: diff --git a/docs/database/sql-server-entity-framework-integration.md b/docs/database/sql-server-entity-framework-integration.md index c570125d41..8d3c3bdcd9 100644 --- a/docs/database/sql-server-entity-framework-integration.md +++ b/docs/database/sql-server-entity-framework-integration.md @@ -187,7 +187,7 @@ Here are the configurable options with corresponding default values: | `DisableMetrics` | A boolean value that indicates whether the OpenTelemetry metrics are disabled or not. | | `Timeout` | The time in seconds to wait for the command to execute. | -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] By default, the .NET Aspire Sql Server Entity Framework Core integration handles the following: diff --git a/docs/fundamentals/integrations-overview.md b/docs/fundamentals/integrations-overview.md index 16dec58b44..69405e3bc3 100644 --- a/docs/fundamentals/integrations-overview.md +++ b/docs/fundamentals/integrations-overview.md @@ -1,7 +1,7 @@ --- title: .NET Aspire integrations overview description: Explore the fundamental concepts of .NET Aspire integrations and learn how to integrate them into your apps. -ms.date: 12/09/2024 +ms.date: 02/06/2025 ms.topic: conceptual uid: dotnet/aspire/integrations --- @@ -103,25 +103,26 @@ For more information on working with .NET Aspire integrations in Visual Studio, Azure integrations configure applications to use Azure resources. These hosting integrations are available in the `Aspire.Hosting.Azure.*` NuGet packages, while their client integrations are available in the `Aspire.*` NuGet packages: <!-- markdownlint-disable MD033 MD045 --> -| Integration docs and NuGet packages | Description | -|--|--| -| - **Learn more**: [π Azure App Configuration](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.AppConfiguration/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.AppConfiguration](https://www.nuget.org/packages/Aspire.Hosting.Azure.AppConfiguration)<br>- **Client**: N/A | A library for interacting with [Azure App Configuration](/azure/azure-app-configuration/). | -| - **Learn more**: [π Azure Application Insights](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.ApplicationInsights/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.ApplicationInsights](https://www.nuget.org/packages/Aspire.Hosting.Azure.ApplicationInsights)<br>- **Client**: N/A | A library for interacting with [Azure Application Insights](/azure/azure-monitor/app/app-insights-overview). | -| - **Learn more**: [π Azure Cosmos DB - EF Core](../database/azure-cosmos-db-entity-framework-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.CosmosDB](https://www.nuget.org/packages/Aspire.Hosting.Azure.CosmosDB)<br>- **Client**: [π¦ Aspire.Microsoft.EntityFrameworkCore.Cosmos](https://www.nuget.org/packages/Aspire.Microsoft.EntityFrameworkCore.Cosmos) | A library for accessing Azure Cosmos DB databases with [Entity Framework Core](/ef/core/providers/cosmos/). | -| - **Learn more**: [π Azure Cosmos DB](../database/azure-cosmos-db-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.CosmosDB](https://www.nuget.org/packages/Aspire.Hosting.Azure.CosmosDB)<br>- **Client**: [π¦ Aspire.Microsoft.Azure.Cosmos](https://www.nuget.org/packages/Aspire.Microsoft.Azure.Cosmos) | A library for accessing [Azure Cosmos DB](/azure/cosmos-db/introduction) databases. | -| - **Learn more**: [π Azure Event Hubs](../messaging/azure-event-hubs-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.EventHubs](https://www.nuget.org/packages/Aspire.Hosting.Azure.EventHubs)<br>- **Client**: [π¦ Aspire.Azure.Messaging.EventHubs](https://www.nuget.org/packages/Aspire.Azure.Messaging.EventHubs) | A library for accessing [Azure Event Hubs](/azure/event-hubs/event-hubs-about). | -| - **Learn more**: [π Azure Functions](../serverless/functions.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Functions](https://www.nuget.org/packages/Aspire.Hosting.Azure.Functions)<br>- **Client**: N/A | A library for integrating with [Azure Functions](/azure/azure-functions/). | -| - **Learn more**: [π Azure Key Vault](../security/azure-security-key-vault-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.KeyVault](https://www.nuget.org/packages/Aspire.Hosting.Azure.KeyVault)<br>- **Client**: [π¦ Aspire.Azure.Security.KeyVault](https://www.nuget.org/packages/Aspire.Azure.Security.KeyVault) | A library for accessing [Azure Key Vault](/azure/key-vault/general/overview). | -| - **Learn more**: [π Azure Operational Insights](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.OperationalInsights/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.OperationalInsights](https://www.nuget.org/packages/Aspire.Hosting.Azure.OperationalInsights)<br>- **Client**: N/A | A library for interacting with [Azure Operational Insights](/azure/azure-monitor/logs/log-analytics-workspace-overview). | -| - **Learn more**: [π Azure AI OpenAI](../azureai/azureai-openai-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.CognitiveServices](https://www.nuget.org/packages/Aspire.Hosting.Azure.CognitiveServices)<br>- **Client**: [π¦ Aspire.Azure.AI.OpenAI](https://www.nuget.org/packages/Aspire.Azure.AI.OpenAI) | A library for accessing [Azure AI OpenAI](/azure/ai-services/openai/overview) or OpenAI functionality. | -| - **Learn more**: [π Azure PostgreSQL](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.PostgreSQL/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.PostgreSQL](https://www.nuget.org/packages/Aspire.Hosting.Azure.PostgreSQL)<br>- **Client**: N/A | A library for interacting with [Azure Database for PostgreSQL](/azure/postgresql/). | -| - **Learn more**: [π Azure AI Search](../azureai/azureai-search-document-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Search](https://www.nuget.org/packages/Aspire.Hosting.Azure.Search)<br>- **Client**: [π¦ Aspire.Azure.Search.Documents](https://www.nuget.org/packages/Aspire.Azure.Search.Documents) | A library for accessing [Azure AI Search](/azure/search/search-what-is-azure-search) functionality. | -| - **Learn more**: [π Azure Service Bus](../messaging/azure-service-bus-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.ServiceBus](https://www.nuget.org/packages/Aspire.Hosting.Azure.ServiceBus)<br>- **Client**: [π¦ Aspire.Azure.Messaging.ServiceBus](https://www.nuget.org/packages/Aspire.Azure.Messaging.ServiceBus) | A library for accessing [Azure Service Bus](/azure/service-bus-messaging/service-bus-messaging-overview). | -| - **Learn more**: [π Azure SignalR Service](../real-time/azure-signalr-scenario.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.SignalR](https://www.nuget.org/packages/Aspire.Hosting.Azure.SignalR)<br>- **Client**: [Microsoft.Azure.SignalR](https://www.nuget.org/packages/Microsoft.Azure.SignalR) | A library for accessing [Azure SignalR Service](/azure/azure-signalr/signalr-overview). | -| - **Learn more**: [π Azure Blob Storage](../storage/azure-storage-blobs-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Storage](https://www.nuget.org/packages/Aspire.Hosting.Azure.Storage)<br>- **Client**: [π¦ Aspire.Azure.Storage.Blobs](https://www.nuget.org/packages/Aspire.Azure.Storage.Blobs) | A library for accessing [Azure Blob Storage](/azure/storage/blobs/storage-blobs-introduction). | -| - **Learn more**: [π Azure Storage Queues](../storage/azure-storage-queues-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Storage](https://www.nuget.org/packages/Aspire.Hosting.Azure.Storage)<br>- **Client**: [π¦ Aspire.Azure.Storage.Queues](https://www.nuget.org/packages/Aspire.Azure.Storage.Queues) | A library for accessing [Azure Storage Queues](/azure/storage/queues/storage-queues-introduction). | -| - **Learn more**: [π Azure Table Storage](../storage/azure-storage-tables-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Storage](https://www.nuget.org/packages/Aspire.Hosting.Azure.Storage)<br>- **Client**: [π¦ Aspire.Azure.Data.Tables](https://www.nuget.org/packages/Aspire.Azure.Data.Tables) | A library for accessing the [Azure Table](/azure/storage/tables/table-storage-overview) service. | -| - **Learn more**: [π Azure Web PubSub](../messaging/azure-web-pubsub-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.WebPubSub](https://www.nuget.org/packages/Aspire.Hosting.Azure.WebPubSub)<br>- **Client**: [π¦ Aspire.Azure.Messaging.WebPubSub](https://www.nuget.org/packages/Aspire.Azure.Messaging.WebPubSub) | A library for accessing the [Azure Web PubSub](/azure/azure-web-pubsub/) service. | +| Integration | Docs and NuGet packages | Description | +|--|--|--| +| <img src="media/icons/AzureAppConfig_256x.png" alt="Azure App Configuration logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure App Configuration](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.AppConfiguration/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.AppConfiguration](https://www.nuget.org/packages/Aspire.Hosting.Azure.AppConfiguration)<br>- **Client**: N/A | A library for interacting with [Azure App Configuration](/azure/azure-app-configuration/). | +| <img src="media/icons/AzureAppInsights_256x.png" alt="Azure Application Insights logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Application Insights](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.ApplicationInsights/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.ApplicationInsights](https://www.nuget.org/packages/Aspire.Hosting.Azure.ApplicationInsights)<br>- **Client**: N/A | A library for interacting with [Azure Application Insights](/azure/azure-monitor/app/app-insights-overview). | +| <img src="media/icons/AzureCacheRedis_256x.png" alt="Azure Cache for Redis logo" role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Cache for Redis](../caching/azure-cache-for-redis-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Redis](https://www.nuget.org/packages/Aspire.Hosting.Azure.Redis)<br>- **Client**: [π¦ Aspire.StackExchange.Redis](https://www.nuget.org/packages/Aspire.StackExchange.Redis) or [π¦ Aspire.StackExchange.Redis.DistributedCaching](https://www.nuget.org/packages/Aspire.StackExchange.Redis.DistributedCaching) or [π¦ Aspire.StackExchange.Redis.OutputCaching](https://www.nuget.org/packages/Aspire.StackExchange.Redis.OutputCaching) | A library for accessing [Azure Cache for Redis](/azure/azure-cache-for-redis/). | +| <img src="media/icons/AzureCosmosDB_256x.png" alt="Azure Cosmos DB EF logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Cosmos DB - EF Core](../database/azure-cosmos-db-entity-framework-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.CosmosDB](https://www.nuget.org/packages/Aspire.Hosting.Azure.CosmosDB)<br>- **Client**: [π¦ Aspire.Microsoft.EntityFrameworkCore.Cosmos](https://www.nuget.org/packages/Aspire.Microsoft.EntityFrameworkCore.Cosmos) | A library for accessing Azure Cosmos DB databases with [Entity Framework Core](/ef/core/providers/cosmos/). | +| <img src="media/icons/AzureCosmosDB_256x.png" alt="Azure Cosmos DB logo." role="presentation" width="78" data-linktype="relative-path">| - **Learn more**: [π Azure Cosmos DB](../database/azure-cosmos-db-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.CosmosDB](https://www.nuget.org/packages/Aspire.Hosting.Azure.CosmosDB)<br>- **Client**: [π¦ Aspire.Microsoft.Azure.Cosmos](https://www.nuget.org/packages/Aspire.Microsoft.Azure.Cosmos) | A library for accessing [Azure Cosmos DB](/azure/cosmos-db/introduction) databases. | +| <img src="media/icons/AzureEventHubs_256x.png" alt="Azure Event Hubs logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Event Hubs](../messaging/azure-event-hubs-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.EventHubs](https://www.nuget.org/packages/Aspire.Hosting.Azure.EventHubs)<br>- **Client**: [π¦ Aspire.Azure.Messaging.EventHubs](https://www.nuget.org/packages/Aspire.Azure.Messaging.EventHubs) | A library for accessing [Azure Event Hubs](/azure/event-hubs/event-hubs-about). | +| <img src="media/icons/AzureFunctionApps_256x.png" alt="Azure Functions logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Functions](../serverless/functions.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Functions](https://www.nuget.org/packages/Aspire.Hosting.Azure.Functions)<br>- **Client**: N/A | A library for integrating with [Azure Functions](/azure/azure-functions/). | +| <img src="media/icons/AzureKeyVault_256x.png" alt="Azure Key Vault logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Key Vault](../security/azure-security-key-vault-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.KeyVault](https://www.nuget.org/packages/Aspire.Hosting.Azure.KeyVault)<br>- **Client**: [π¦ Aspire.Azure.Security.KeyVault](https://www.nuget.org/packages/Aspire.Azure.Security.KeyVault) | A library for accessing [Azure Key Vault](/azure/key-vault/general/overview). | +| <img src="media/icons/AzureLogAnalytics_256x.png" alt="Azure Operational Insights logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Operational Insights](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.OperationalInsights/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.OperationalInsights](https://www.nuget.org/packages/Aspire.Hosting.Azure.OperationalInsights)<br>- **Client**: N/A | A library for interacting with [Azure Operational Insights](/azure/azure-monitor/logs/log-analytics-workspace-overview). | +| <img src="media/icons/AzureOpenAI_256x.png" alt="Azure OpenAI logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure AI OpenAI](../azureai/azureai-openai-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.CognitiveServices](https://www.nuget.org/packages/Aspire.Hosting.Azure.CognitiveServices)<br>- **Client**: [π¦ Aspire.Azure.AI.OpenAI](https://www.nuget.org/packages/Aspire.Azure.AI.OpenAI) | A library for accessing [Azure AI OpenAI](/azure/ai-services/openai/overview) or OpenAI functionality. | +| <img src="media/icons/AzurePostgreSQL_256x.png" alt="Azure PostgreSQL logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure PostgreSQL](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Azure.PostgreSQL/README.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.PostgreSQL](https://www.nuget.org/packages/Aspire.Hosting.Azure.PostgreSQL)<br>- **Client**: N/A | A library for interacting with [Azure Database for PostgreSQL](/azure/postgresql/). | +| <img src="media/icons/AzureSearch_256x.png" alt="Azure AI Search logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure AI Search](../azureai/azureai-search-document-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Search](https://www.nuget.org/packages/Aspire.Hosting.Azure.Search)<br>- **Client**: [π¦ Aspire.Azure.Search.Documents](https://www.nuget.org/packages/Aspire.Azure.Search.Documents) | A library for accessing [Azure AI Search](/azure/search/search-what-is-azure-search) functionality. | +| <img src="media/icons/AzureServiceBus_256x.png" alt="Azure Service Bus logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Service Bus](../messaging/azure-service-bus-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.ServiceBus](https://www.nuget.org/packages/Aspire.Hosting.Azure.ServiceBus)<br>- **Client**: [π¦ Aspire.Azure.Messaging.ServiceBus](https://www.nuget.org/packages/Aspire.Azure.Messaging.ServiceBus) | A library for accessing [Azure Service Bus](/azure/service-bus-messaging/service-bus-messaging-overview). | +| <img src="media/icons/AzureSignalR_256x.png" alt="Azure SignalR Service logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure SignalR Service](../real-time/azure-signalr-scenario.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.SignalR](https://www.nuget.org/packages/Aspire.Hosting.Azure.SignalR)<br>- **Client**: [Microsoft.Azure.SignalR](https://www.nuget.org/packages/Microsoft.Azure.SignalR) | A library for accessing [Azure SignalR Service](/azure/azure-signalr/signalr-overview). | +| <img src="media/icons/AzureBlobPageStorage_256x.png" alt="Azure Blob Storage logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Blob Storage](../storage/azure-storage-blobs-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Storage](https://www.nuget.org/packages/Aspire.Hosting.Azure.Storage)<br>- **Client**: [π¦ Aspire.Azure.Storage.Blobs](https://www.nuget.org/packages/Aspire.Azure.Storage.Blobs) | A library for accessing [Azure Blob Storage](/azure/storage/blobs/storage-blobs-introduction). | +| <img src="media/icons/AzureStorageQueue_256x.png" alt="Azure Storage Queues logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Storage Queues](../storage/azure-storage-queues-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Storage](https://www.nuget.org/packages/Aspire.Hosting.Azure.Storage)<br>- **Client**: [π¦ Aspire.Azure.Storage.Queues](https://www.nuget.org/packages/Aspire.Azure.Storage.Queues) | A library for accessing [Azure Storage Queues](/azure/storage/queues/storage-queues-introduction). | +| <img src="media/icons/AzureTable_256x.png" alt="Azure Table Storage logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Table Storage](../storage/azure-storage-tables-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.Storage](https://www.nuget.org/packages/Aspire.Hosting.Azure.Storage)<br>- **Client**: [π¦ Aspire.Azure.Data.Tables](https://www.nuget.org/packages/Aspire.Azure.Data.Tables) | A library for accessing the [Azure Table](/azure/storage/tables/table-storage-overview) service. | +| <img src="media/icons/AzureWebPubSub_256x.png" alt="Azure Web PubSub logo." role="presentation" width="78" data-linktype="relative-path"> | - **Learn more**: [π Azure Web PubSub](../messaging/azure-web-pubsub-integration.md) <br/> - **Hosting**: [π¦ Aspire.Hosting.Azure.WebPubSub](https://www.nuget.org/packages/Aspire.Hosting.Azure.WebPubSub)<br>- **Client**: [π¦ Aspire.Azure.Messaging.WebPubSub](https://www.nuget.org/packages/Aspire.Azure.Messaging.WebPubSub) | A library for accessing the [Azure Web PubSub](/azure/azure-web-pubsub/) service. | <!-- markdownlint-enable MD033 MD045 --> ### Amazon Web Services (AWS) hosting integrations diff --git a/docs/fundamentals/media/icons/AzureBlobPageStorage_256x.png b/docs/fundamentals/media/icons/AzureBlobPageStorage_256x.png new file mode 100644 index 0000000000..607d346e9e Binary files /dev/null and b/docs/fundamentals/media/icons/AzureBlobPageStorage_256x.png differ diff --git a/docs/fundamentals/media/icons/AzureFunctionApps_256x.png b/docs/fundamentals/media/icons/AzureFunctionApps_256x.png new file mode 100644 index 0000000000..ecba6661e3 Binary files /dev/null and b/docs/fundamentals/media/icons/AzureFunctionApps_256x.png differ diff --git a/docs/fundamentals/media/integrations-thumb.png b/docs/fundamentals/media/integrations-thumb.png index eef466a45b..94c4fe4d2f 100644 Binary files a/docs/fundamentals/media/integrations-thumb.png and b/docs/fundamentals/media/integrations-thumb.png differ diff --git a/docs/fundamentals/media/integrations.excalidraw b/docs/fundamentals/media/integrations.excalidraw index 0c8f8c2159..ba048b9fba 100644 --- a/docs/fundamentals/media/integrations.excalidraw +++ b/docs/fundamentals/media/integrations.excalidraw @@ -12,7 +12,7 @@ "height": 116.44586233380028, "angle": 0, "strokeColor": "#ffffff", - "backgroundColor": "#ffffff", + "backgroundColor": "transparent", "fillStyle": "solid", "strokeWidth": 1, "strokeStyle": "solid", @@ -23,128 +23,11 @@ "index": "aZ", "roundness": null, "seed": 40654804, - "version": 159, - "versionNonce": 1951460564, - "isDeleted": false, - "boundElements": null, - "updated": 1730826467413, - "link": null, - "locked": false - }, - { - "id": "UkozcL4XOrVG4uvpyQ9w5", - "type": "rectangle", - "x": 885.6078841774183, - "y": -437.2527943418964, - "width": 14.919749773649656, - "height": 445.79477627376747, - "angle": 0, - "strokeColor": "#ffffff", - "backgroundColor": "#ffffff", - "fillStyle": "solid", - "strokeWidth": 2, - "strokeStyle": "solid", - "roughness": 0, - "opacity": 100, - "groupIds": [], - "frameId": null, - "index": "aa", - "roundness": null, - "seed": 561198804, - "version": 685, - "versionNonce": 381964756, - "isDeleted": false, - "boundElements": [], - "updated": 1730826454403, - "link": null, - "locked": false - }, - { - "id": "opfoDtnlzhhC7YVQGwH-5", - "type": "rectangle", - "x": 345.6356856652692, - "y": -238.6158629493345, - "width": 555.2969156775546, - "height": 19.159126212637148, - "angle": 0, - "strokeColor": "#ffffff", - "backgroundColor": "#ffffff", - "fillStyle": "solid", - "strokeWidth": 2, - "strokeStyle": "solid", - "roughness": 0, - "opacity": 100, - "groupIds": [], - "frameId": null, - "index": "ab", - "roundness": null, - "seed": 328352084, - "version": 586, - "versionNonce": 1557540332, - "isDeleted": false, - "boundElements": [], - "updated": 1730826448835, - "link": null, - "locked": false - }, - { - "id": "Pl2zT-c6qlEGgpGtHcKbJ", - "type": "rectangle", - "x": 885.3580537429135, - "y": -10.487504732911361, - "width": 129.281709964706, - "height": 19.511245863037402, - "angle": 0, - "strokeColor": "#ffffff", - "backgroundColor": "#ffffff", - "fillStyle": "solid", - "strokeWidth": 2, - "strokeStyle": "solid", - "roughness": 0, - "opacity": 100, - "groupIds": [], - "frameId": null, - "index": "ac", - "roundness": null, - "seed": 1799961452, - "version": 287, - "versionNonce": 2055935956, + "version": 160, + "versionNonce": 62395714, "isDeleted": false, "boundElements": [], - "updated": 1730826358800, - "link": null, - "locked": false - }, - { - "id": "D8jpaFlfGHbtpatXXCZhR", - "type": "rectangle", - "x": 885.8929981634673, - "y": -437.1241557312922, - "width": 132.73147003668407, - "height": 19.197629679658178, - "angle": 0, - "strokeColor": "#ffffff", - "backgroundColor": "#ffffff", - "fillStyle": "solid", - "strokeWidth": 2, - "strokeStyle": "solid", - "roughness": 0, - "opacity": 100, - "groupIds": [], - "frameId": null, - "index": "ad", - "roundness": null, - "seed": 1122434028, - "version": 146, - "versionNonce": 1447338452, - "isDeleted": false, - "boundElements": [ - { - "id": "_KdUqv10orMLk7dx8GmgM", - "type": "arrow" - } - ], - "updated": 1730826355565, + "updated": 1738876377614, "link": null, "locked": false }, @@ -654,11 +537,11 @@ "index": "av", "roundness": null, "seed": 1150112789, - "version": 196, - "versionNonce": 1811758292, + "version": 197, + "versionNonce": 1276753630, "isDeleted": false, "boundElements": [], - "updated": 1730826356286, + "updated": 1738876365661, "link": null, "locked": false, "points": [ @@ -672,12 +555,7 @@ ] ], "lastCommittedPoint": null, - "startBinding": { - "elementId": "D8jpaFlfGHbtpatXXCZhR", - "focus": -0.0006845855370267234, - "gap": 1, - "fixedPoint": null - }, + "startBinding": null, "endBinding": { "elementId": "owpYWG6M3ugkY8Kq2doze", "focus": -0.0843023241681942, diff --git a/docs/fundamentals/media/integrations.png b/docs/fundamentals/media/integrations.png index f86e33996f..2ba3f75bf3 100644 Binary files a/docs/fundamentals/media/integrations.png and b/docs/fundamentals/media/integrations.png differ diff --git a/docs/includes/client-integration-health-checks.md b/docs/includes/client-integration-health-checks.md new file mode 100644 index 0000000000..7e10b2feeb --- /dev/null +++ b/docs/includes/client-integration-health-checks.md @@ -0,0 +1,12 @@ +--- +title: .NET Aspire integrations health checks +description: Learn how to use health checks with .NET Aspire integrations. +ms.topic: include +--- + +### Client integration health checks + +By default, .NET Aspire _client integrations_ have [health checks](../fundamentals/health-checks.md) enabled for all services. Similarly, many .NET Aspire _hosting integrations_ also enable health check endpoints. For more information, see: + +- [.NET app health checks in C#](/dotnet/core/diagnostics/diagnostic-health-checks) +- [Health checks in ASP.NET Core](/aspnet/core/host-and-deploy/health-checks) diff --git a/docs/includes/integration-health-checks.md b/docs/includes/integration-health-checks.md deleted file mode 100644 index f52632eb8b..0000000000 --- a/docs/includes/integration-health-checks.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: .NET Aspire integrations health checks -description: Learn how to use health checks with .NET Aspire integrations. -ms.topic: include ---- - -### Health checks - -By default, .NET Aspire integrations enable [health checks](../fundamentals/health-checks.md) for all services. For more information, see [.NET Aspire integrations overview](../fundamentals/integrations-overview.md). diff --git a/docs/logging/seq-integration.md b/docs/logging/seq-integration.md index cadb4f07f7..b412d8a399 100644 --- a/docs/logging/seq-integration.md +++ b/docs/logging/seq-integration.md @@ -180,7 +180,7 @@ builder.AddSeqEndpoint("seq", static settings => }); ``` -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] The .NET Aspire Seq integration handles the following: diff --git a/docs/messaging/azure-web-pubsub-integration.md b/docs/messaging/azure-web-pubsub-integration.md index 32fa44df1e..064fd1c991 100644 --- a/docs/messaging/azure-web-pubsub-integration.md +++ b/docs/messaging/azure-web-pubsub-integration.md @@ -166,7 +166,7 @@ builder.AddAzureWebPubSubServiceClient( clientBuilder.ConfigureOptions(options => options.Retry.MaxRetries = 5)); ``` -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] The .NET Aspire Azure Web PubSub integration handles exposes a configurable health check that reports as _healthy_, when the client can successfully connect to the Azure Web PubSub service. diff --git a/docs/security/azure-security-key-vault-integration.md b/docs/security/azure-security-key-vault-integration.md index f79dbd1c5b..180446a232 100644 --- a/docs/security/azure-security-key-vault-integration.md +++ b/docs/security/azure-security-key-vault-integration.md @@ -166,7 +166,7 @@ The following configurable options are exposed through the <xref:Aspire.Azure.Se | `DisableHealthChecks` | A boolean value that indicates whether the Key Vault health check is disabled or not. | | `DisableTracing` | A boolean value that indicates whether the OpenTelemetry tracing is disabled or not. | -[!INCLUDE [integration-health-checks](../includes/integration-health-checks.md)] +[!INCLUDE [client-integration-health-checks](../includes/client-integration-health-checks.md)] The .NET Aspire Azure Key Vault integration includes the following health checks: diff --git a/docs/snippets/azure/AppHost/Program.ConfigureRedisInfra.cs b/docs/snippets/azure/AppHost/Program.ConfigureRedisInfra.cs new file mode 100644 index 0000000000..976835da2a --- /dev/null +++ b/docs/snippets/azure/AppHost/Program.ConfigureRedisInfra.cs @@ -0,0 +1,27 @@ +ο»Ώusing Azure.Provisioning.Redis; +using RedisResource = Azure.Provisioning.Redis.RedisResource; + +internal static partial class Program +{ + public static void ConfigureRedisInfra(IDistributedApplicationBuilder builder) + { + // <configure> + builder.AddAzureRedis("redis") + .WithAccessKeyAuthentication() + .ConfigureInfrastructure(infra => + { + var redis = infra.GetProvisionableResources() + .OfType<RedisResource>() + .Single(); + + redis.Sku = new() + { + Family = RedisSkuFamily.BasicOrStandard, + Name = RedisSkuName.Standard, + Capacity = 1, + }; + redis.Tags.Add("ExampleKey", "Example value"); + }); + // </configure> + } +} diff --git a/docs/snippets/azure/AppHost/postgres-flexible.module.bicep b/docs/snippets/azure/AppHost/postgres-flexible.module.bicep index 21fbde0af9..4e879a5de0 100644 --- a/docs/snippets/azure/AppHost/postgres-flexible.module.bicep +++ b/docs/snippets/azure/AppHost/postgres-flexible.module.bicep @@ -59,4 +59,4 @@ resource postgres_flexible_admin 'Microsoft.DBforPostgreSQL/flexibleServers/admi ] } -output connectionString string = 'Host=${postgres_flexible.properties.fullyQualifiedDomainName};Username=${principalName}' +output connectionString string = 'Host=${postgres_flexible.properties.fullyQualifiedDomainName};Username=${principalName}' \ No newline at end of file diff --git a/docs/toc.yml b/docs/toc.yml index df4a7933ff..60c2dea8a2 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -135,6 +135,14 @@ items: href: azure/integrations-overview.md - name: Local Azure provisioning href: azure/local-provisioning.md + - name: Azure Cache for Redis + items: + - name: Azure Cache for Redis + href: caching/azure-cache-for-redis-integration.md + - name: Azure Cache for Redis distributed cache + href: caching/azure-cache-for-redis-distributed-caching-integration.md + - name: Azure Cache for Redis output caching + href: caching/azure-cache-for-redis-output-caching-integration.md - name: Azure Cosmos DB items: - name: Azure Cosmos DB - EF Core @@ -152,12 +160,14 @@ items: - name: Azure Key Vault displayName: key vault,security href: security/azure-security-key-vault-integration.md - - name: Azure PostgreSQL - EF Core - displayName: postgres,postgresql,database,flexible server,ef core,azure for database - href: database/azure-postgresql-entity-framework-integration.md - name: Azure PostgreSQL - displayName: postgres,postgresql,database,flexible server,azure for database - href: database/azure-postgresql-integration.md + items: + - name: Azure PostgreSQL - EF Core + displayName: postgres,postgresql,database,flexible server,ef core,azure for database + href: database/azure-postgresql-entity-framework-integration.md + - name: Azure PostgreSQL + displayName: postgres,postgresql,database,flexible server,azure for database + href: database/azure-postgresql-integration.md - name: Azure OpenAI displayName: azure ai,openai href: azureai/azureai-openai-integration.md diff --git a/docs/whats-new/dotnet-aspire-9.md b/docs/whats-new/dotnet-aspire-9.md index 01593dda90..e4b072f3ec 100644 --- a/docs/whats-new/dotnet-aspire-9.md +++ b/docs/whats-new/dotnet-aspire-9.md @@ -375,7 +375,7 @@ In order to make .NET Aspire applications more secure, Azure Database for Postgr The following examples demonstrate how to configure your application to connect to the Azure resources using Microsoft Entra ID: - [.NET Aspire: Azure PostgreSQL hosting integration](../database/azure-postgresql-integration.md). -- [.NET Aspire: Azure Redis hosting integration](../caching/stackexchange-redis-integration.md#azure-redis-hosting-integration). +- [.NET Aspire: Azure Redis hosting integration](../caching/azure-cache-for-redis-integration.md#hosting-integration). If you need to use password or access key authentication (not recommended), you can opt-in with the following code: