microsoft / microsoft/aspire

Azure Managed Redis: Customize provisioning infrastructure docs example does not work / out of date.

Open
#13,994 3 comments 0 reactions 0 assignees View on GitHub
area-deployment
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Using the provided example for [Azure Cache for Redis - customizing provisioning infrastructure docs](https://aspire.dev/integrations/cloud/azure/azure-cache-redis/#customize-provisioning-infrastructure) does not work.

Example from docs
```csharp
var builder = DistributedApplication.CreateBuilder(args);

builder.AddAzureRedis("redis")
.WithAccessKeyAuthentication()
.ConfigureInfrastructure(infra =>
{
var redis = infra.GetProvisionableResources()
.OfType()
.Single();

redis.Sku = new()
{
Family = RedisSkuFamily.BasicOrStandard,
Name = RedisSkuName.Standard,
Capacity = 1,
};
redis.Tags.Add("ExampleKey", "Example value");
});
```

This results in an `obsolete` warning for `.AddAzureRedis`.

Following the upgrade docs as per the [Aspire 13.1 Breaking Changes](https://aspire.dev/whats-new/aspire-13-1/#azure-redis-api-rename), changing `.AddAzureRedis` to `.AddAzureManagedRedis` results in `aspire publish` failing with the following output:

```
aspire publish --log-level trace

14:17:41 (pipeline-execution) → Starting pipeline-execution...
14:17:41 (pipeline-execution) ✗ [ERR] Sequence contains no elements
14:17:41 (pipeline-execution) ✗ Failed
------------------------------------------------------------
✓ 0/1 steps succeeded • ✗ 1 failed • Total time: 0.35s

Steps Summary:
85.82ms ✗ pipeline-execution

✗ PIPELINE FAILED
------------------------------------------------------------
```

### Expected Behavior

The documentation should have a valid example on how to add `Azure Cache for Redis` with a working example of customising infrastructure.

### Steps To Reproduce

```csharp
// AppHost

var builder = DistributedApplication.CreateBuilder(args);

builder.AddAzureManagedRedis("redis")
.WithAccessKeyAuthentication()
.ConfigureInfrastructure(infra =>
{
var redis = infra.GetProvisionableResources()
.OfType()
.Single();

redis.Sku = new()
{
Family = RedisSkuFamily.BasicOrStandard,
Name = RedisSkuName.Standard,
Capacity = 1,
};
redis.Tags.Add("ExampleKey", "Example value");
});
```

```
aspire publish --log-level trace
```

### Exceptions (if any)

_No response_

### .NET Version info

.NET Version = 10.0.102

Aspire Version = 13.1.0+8a4db1775c3fbae1c602022b636299cb04971fde

### Anything else?

Aspire Version = 13.1.0+8a4db1775c3fbae1c602022b636299cb04971fde

PackageReference - Aspire.Hosting.Azure.Redis" Version="13.1.0"

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.