# RedisResource Properties

- Package: [Aspire.Hosting.Redis](/reference/api/csharp/aspire.hosting.redis.md)
- Type: [RedisResource](/reference/api/csharp/aspire.hosting.redis/redisresource.md)
- Kind: `Properties`
- Members: `7`

A resource that represents a Redis resource independent of the hosting model.

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs#L108-L113)

Gets the connection string expression for the Redis server.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

## Host

- Name: `Host`
- Modifiers: `get`
- Returns: `EndpointReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs#L54)

Gets the host endpoint reference for this resource.

```csharp
public EndpointReferenceExpression Host { get; }
```

## PasswordParameter

- Name: `PasswordParameter`
- Modifiers: `nullable` `get`
- Returns: `ParameterResource?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs)

Gets the parameter that contains the Redis server password.

```csharp
public ParameterResource? PasswordParameter { get; }
```

## Port

- Name: `Port`
- Modifiers: `get`
- Returns: `EndpointReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs#L59)

Gets the port endpoint reference for this resource.

```csharp
public EndpointReferenceExpression Port { get; }
```

## PrimaryEndpoint

- Name: `PrimaryEndpoint`
- Modifiers: `get`
- Returns: `EndpointReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs#L49)

Gets the primary endpoint for the Redis server.

```csharp
public EndpointReference PrimaryEndpoint { get; }
```

## TlsEnabled

- Name: `TlsEnabled`
- Modifiers: `get`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs#L77)

Indicates whether TLS is enabled for the Redis server.

```csharp
public bool TlsEnabled { get; }
```

## Remarks

This property proxies through to `EndpointAnnotation.TlsEnabled` on the [RedisResource.PrimaryEndpoint](/reference/api/csharp/aspire.hosting.redis/redisresource/properties.md#primaryendpoint). When set to `true`, the connection string expression dynamically includes `,ssl=true` and the URI expression uses the `rediss://` scheme. This value is resolved lazily at expression evaluation time, avoiding timing issues when TLS is enabled later in the application lifecycle (e.g., during the `BeforeStartEvent`).

## UriExpression

- Name: `UriExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Redis/RedisResource.cs#L147-L160)

Gets the connection URI expression for the Redis server.

```csharp
public ReferenceExpression UriExpression { get; }
```

## Remarks

Format: `redis://[:{password}@]{host}:{port}`. The password segment is omitted when no password is configured.
