Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,41 @@ var exampleProject = builder.AddProject<Projects.ExampleProject>()
The TypeScript AppHost doesn't currently expose a `withClearCommand()` API for Redis. This feature is only available in the C# AppHost.
</Aside>

## Add Redis resource with a REPL command

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase A — unverifiable against the target branch (release/13.6). WithRepl() / withRepl() for Redis does not exist in microsoft/aspire release/13.6 (SHA 8536cc330b). It ships in microsoft/aspire#20231, which merged to main (milestone 14.0); the merge commit isn't an ancestor of release/13.6, and the branch has no WithRepl/WithReplCommand/CreateReplOptionsAsync.

Accurate for 14.0: src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs defines WithRepl (redis-cli, REDISCLI_AUTH env, non-TLS loopback via the secondary endpoint when TLS is enabled). Because this PR targets release/13.6, the claim is unverifiable there — please confirm the intended branch or version-gate the section.


The `WithRepl` method adds an opt-in **REPL** command to the Redis resource in the Aspire dashboard. Selecting the command while the container is running opens an authenticated `redis-cli` session in the dashboard's terminal dock—no local Redis client installation is required:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">
```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedis("cache")
.WithRepl();
Comment on lines +476 to +477

builder.Build().Run();
```
</TabItem>
<TabItem id="typescript" label="TypeScript">
```typescript title="apphost.mts" twoslash
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const cache = await builder.addRedis("cache");
await cache.withRepl();

await builder.build().run();
```
</TabItem>
</Tabs>

The REPL command is disabled by default and is only registered in run mode—it isn't available in published applications. Use `quit` to exit `redis-cli` cleanly before closing the terminal tab; closing the tab alone can leave `redis-cli` running inside the container, and stopping the container ends any remaining REPL processes. The session runs inside the container using Docker (or the configured Podman runtime), and passwords are passed through environment variables rather than command-line arguments. When TLS is enabled, the in-container REPL uses the non-TLS port over loopback.

:::caution
Only enable `WithRepl()` for resources whose authenticated client access is appropriate for everyone who can access the dashboard. The shell uses the resource's configured credentials and isn't read-only. Sharing the dashboard through a tunnel, Codespaces, or VS Code remote development also exposes this capability to anyone who can execute resource commands.
:::

## Pass custom environment variables

By default, Aspire injects the Redis connection information using variable names derived from the resource name (for example, `CACHE_URI`, `CACHE_HOST`, `CACHE_PORT`, `CACHE_PASSWORD`). If your consuming app expects a different set of environment variable names, pass individual connection properties from the AppHost:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,41 @@ await builder.addNodeApp("api", "./api", "index.js")

When no `password` parameter is provided, Aspire generates a strong password automatically using the `CreateDefaultPasswordParameter` method.

## Add Valkey resource with a REPL command

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase A — unverifiable against the target branch (release/13.6). Valkey WithRepl() / withRepl() isn't present in microsoft/aspire release/13.6 (SHA 8536cc330b); it ships in microsoft/aspire#20231 (merged to main, milestone 14.0).

Accurate for 14.0: src/Aspire.Hosting.Valkey/ValkeyBuilderExtensions.cs defines WithRepl (valkey-cli, password via env). Unverifiable on the 13.6 branch this PR targets — please confirm the intended branch or version-gate the section.


The `WithRepl` method adds an opt-in **REPL** command to the Valkey resource in the Aspire dashboard. Selecting the command while the container is running opens an authenticated `valkey-cli` session in the dashboard's terminal dock—no local Valkey client installation is required:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">
```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddValkey("cache")
.WithRepl();
Comment on lines +296 to +297

builder.Build().Run();
```
</TabItem>
<TabItem id="typescript" label="TypeScript">
```typescript title="apphost.mts" twoslash
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const cache = await builder.addValkey("cache");
await cache.withRepl();

await builder.build().run();
```
</TabItem>
</Tabs>

The REPL command is disabled by default and is only registered in run mode—it isn't available in published applications. Use `quit` to exit `valkey-cli` cleanly before closing the terminal tab; closing the tab alone can leave `valkey-cli` running inside the container, and stopping the container ends any remaining REPL processes. The session runs inside the container using Docker (or the configured Podman runtime), and passwords are passed through environment variables rather than command-line arguments.

:::caution
Only enable `WithRepl()` for resources whose authenticated client access is appropriate for everyone who can access the dashboard. The shell uses the resource's configured credentials and isn't read-only. Sharing the dashboard through a tunnel, Codespaces, or VS Code remote development also exposes this capability to anyone who can execute resource commands.
:::

## Pass custom environment variables

By default, Aspire injects the Valkey connection information using variable names derived from the resource name (for example, `CACHE_URI`, `CACHE_HOST`, `CACHE_PORT`, `CACHE_PASSWORD`). If your consuming app expects a different set of environment variable names, pass individual connection properties from the AppHost:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,41 @@ await mongo.withLifetime("Persistent");
</TabItem>
</Tabs>

## Add MongoDB resource with a REPL command

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase A — unverifiable against the target branch (release/13.6). MongoDB WithRepl() / withRepl() isn't present in microsoft/aspire release/13.6 (SHA 8536cc330b); it ships in microsoft/aspire#20231 (merged to main, milestone 14.0).

Accurate for 14.0: src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs defines WithRepl (mongosh; authSource=admin; directConnection=true incl. replica members; tlsCAFile + localhost SAN). Unverifiable on the 13.6 branch this PR targets — please confirm the intended branch or version-gate the section.


The `WithRepl` method adds an opt-in **REPL** command to the MongoDB server resource in the Aspire dashboard. Selecting the command while the container is running opens the bundled `mongosh` client in the dashboard's terminal dock, authenticated against `admin` with the resource's configured credentials—no local MongoDB client installation is required:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">
```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

var mongo = builder.AddMongoDB("mongo")
.WithRepl();
Comment on lines +560 to +561

builder.Build().Run();
```
</TabItem>
<TabItem id="typescript" label="TypeScript">
```typescript title="apphost.mts" twoslash
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const mongo = await builder.addMongoDB("mongo");
await mongo.withRepl();

await builder.build().run();
```
</TabItem>
</Tabs>

The REPL command is disabled by default and is only registered in run mode—it isn't available in published applications. Use `exit` to end the `mongosh` session cleanly before closing the terminal tab; closing the tab alone can leave `mongosh` running inside the container, and stopping the container ends any remaining REPL processes. The session connects directly to the server inside its container, including replica set members, and credentials are passed through the environment rather than command-line arguments. When TLS is enabled, the shell uses the configured certificate trust bundle and validates the server certificate for `localhost`; custom certificates must cover `localhost` and their issuing CA must be trusted through Aspire's certificate configuration.

:::caution
Only enable `WithRepl()` for resources whose authenticated client access is appropriate for everyone who can access the dashboard. The shell uses the resource's configured credentials and isn't read-only. Sharing the dashboard through a tunnel, Codespaces, or VS Code remote development also exposes this capability to anyone who can execute resource commands.
:::

## Pass custom environment variables

By default, Aspire injects the MongoDB connection information using variable names derived from the resource name (for example, `MONGODB_URI`, `MONGODB_HOST`, `MONGODB_PORT`). If your consuming app expects a different set of environment variable names, pass individual connection properties from the AppHost:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,41 @@ await builder.addNodeApp("api", "./api", "index.js")

When no `password` parameter is provided, Aspire generates a strong password automatically using the `CreateDefaultPasswordParameter` method. For more information, see [External parameters](/get-started/resources/).

## Add MySQL resource with a REPL command

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase A — unverifiable against the target branch (release/13.6). MySQL WithRepl() / withRepl() isn't present in microsoft/aspire release/13.6 (SHA 8536cc330b); it ships in microsoft/aspire#20231 (merged to main, milestone 14.0).

Accurate for 14.0: src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs defines WithRepl (--user=root; MYSQL_PWD env, keeping the password out of argv and SQL history). Unverifiable on the 13.6 branch this PR targets — please confirm the intended branch or version-gate the section.


The `WithRepl` method adds an opt-in **REPL** command to the MySQL server resource in the Aspire dashboard. Selecting the command while the container is running opens the bundled `mysql` client in the dashboard's terminal dock, authenticated as `root` with the resource's configured password—no local MySQL client installation is required:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">
```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

var mysql = builder.AddMySql("mysql")
.WithRepl();
Comment on lines +490 to +491

builder.Build().Run();
```
</TabItem>
<TabItem id="typescript" label="TypeScript">
```typescript title="apphost.mts" twoslash
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const mysql = await builder.addMySql("mysql");
await mysql.withRepl();

await builder.build().run();
```
</TabItem>
</Tabs>

The REPL command is disabled by default and is only registered in run mode—it isn't available in published applications. Use `quit` to exit `mysql` cleanly before closing the terminal tab; closing the tab alone can leave `mysql` running inside the container, and stopping the container ends any remaining REPL processes. The session runs inside the container using Docker (or the configured Podman runtime), and the password is passed through an environment variable rather than command-line arguments or SQL history.

:::caution
Only enable `WithRepl()` for resources whose authenticated client access is appropriate for everyone who can access the dashboard. The shell uses the resource's configured credentials and isn't read-only. Sharing the dashboard through a tunnel, Codespaces, or VS Code remote development also exposes this capability to anyone who can execute resource commands.
:::

## Pass custom environment variables

By default, Aspire injects the MySQL connection information using variable names derived from the resource name (for example, `MYSQLDB_URI`, `MYSQLDB_HOST`, `MYSQLDB_PORT`, `MYSQLDB_PASSWORD`). If your consuming app expects a different set of environment variable names, pass individual connection properties from the AppHost:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,41 @@ await builder.addNodeApp("api", "./api", "index.js")
</TabItem>
</Tabs>

## Add PostgreSQL resource with a REPL command

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase A — unverifiable against the target branch (release/13.6). PostgreSQL WithRepl() / withRepl() isn't present in microsoft/aspire release/13.6 (SHA 8536cc330b); it ships in microsoft/aspire#20231 (merged to main, milestone 14.0).

Accurate for 14.0: src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs defines WithRepl (psql --dbname postgres; PGPASSWORD env). Unverifiable on the 13.6 branch this PR targets — please confirm the intended branch or version-gate the section.


The `WithRepl` method adds an opt-in **REPL** command to the PostgreSQL server resource in the Aspire dashboard. Selecting the command while the container is running opens `psql` in the dashboard's terminal dock, already connected to the `postgres` database with the resource's configured credentials—no local PostgreSQL client installation is required:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">
```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres")
.WithRepl();
Comment on lines +561 to +562

builder.Build().Run();
```
</TabItem>
<TabItem id="typescript" label="TypeScript">
```typescript title="apphost.mts" twoslash
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const postgres = await builder.addPostgres("postgres");
await postgres.withRepl();

await builder.build().run();
```
</TabItem>
</Tabs>

The REPL command is disabled by default and is only registered in run mode—it isn't available in published applications. Use `\connect` to switch databases and `\q` to exit `psql` cleanly before closing the terminal tab; closing the tab alone can leave `psql` running inside the container, and stopping the container ends any remaining REPL processes. The session runs inside the container using Docker (or the configured Podman runtime), and passwords are passed through environment variables rather than command-line arguments.

:::caution
Only enable `WithRepl()` for resources whose authenticated client access is appropriate for everyone who can access the dashboard. The shell uses the resource's configured credentials and isn't read-only. Sharing the dashboard through a tunnel, Codespaces, or VS Code remote development also exposes this capability to anyone who can execute resource commands.
:::

## Pass custom environment variables

By default, Aspire injects the PostgreSQL connection information using variable names derived from the resource name (for example, `POSTGRESDB_URI`, `POSTGRESDB_HOST`, `POSTGRESDB_PORT`). If your consuming app expects a different set of environment variable names, pass individual connection properties from the AppHost:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,48 @@ await builder.build().run();

For a list of available tags, see [SQL Server container image tags](https://mcr.microsoft.com/en-us/artifact/mar/mssql/server/tags).

## Add SQL Server resource with a REPL command

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phase A — unverifiable against the target branch (release/13.6). SQL Server WithRepl() / withRepl() isn't present in microsoft/aspire release/13.6 (SHA 8536cc330b); it ships in microsoft/aspire#20231 (merged to main, milestone 14.0).

Accurate for 14.0: src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs defines WithRepl (sqlcmd -U sa -d master -C; SQLCMDPASSWORD env; dual mssql-tools18/mssql-tools fallback; runs as sa).

Phase B — naming inconsistency. This section names the resource "sqlserver" (AddSqlServer("sqlserver") / addSqlServer("sqlserver")), but every other example on this page uses "sql" (12 occurrences). Consider "sql" here for intra-page consistency.


The `WithRepl` method adds an opt-in **REPL** command to the SQL Server resource in the Aspire dashboard. Selecting the command while the container is running opens `sqlcmd` in the dashboard's terminal dock, connected inside the container as `sa` to the `master` database—no local SQL client installation is required:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">
```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

var sql = builder.AddSqlServer("sqlserver")
.WithRepl();
Comment on lines +428 to +429

builder.Build().Run();
```
</TabItem>
<TabItem id="typescript" label="TypeScript">
```typescript title="apphost.mts" twoslash
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const sql = await builder.addSqlServer("sqlserver");
await sql.withRepl();

await builder.build().run();
```
</TabItem>
</Tabs>

Enter SQL statements followed by `GO` on its own line to execute a batch:

```sql
SELECT DB_NAME();
GO
```

Use `USE [db];` followed by `GO` to switch databases, and `QUIT` to exit `sqlcmd` cleanly before closing the terminal tab; closing the tab alone can leave `sqlcmd` running inside the container, and stopping the container ends any remaining REPL processes. The REPL command is disabled by default and is only registered in run mode—it isn't available in published applications. It uses the configured password without putting it in command-line arguments, and trusts the local server's self-signed certificate, matching the integration's local connection string. It supports both `/opt/mssql-tools18/bin/sqlcmd` in newer SQL Server images and `/opt/mssql-tools/bin/sqlcmd` in older images; custom images must include one of these clients.

:::caution
Only enable `WithRepl()` for resources whose authenticated client access is appropriate for everyone who can access the dashboard. The shell runs as `sa` and can execute server-side operating system commands when enabled. Sharing the dashboard through a tunnel, Codespaces, or VS Code remote development also exposes this capability to anyone who can execute resource commands.
:::

## Pass custom environment variables

By default, Aspire injects the SQL Server connection information using variable names derived from the resource name (for example, `DATABASE_URI`, `DATABASE_HOST`, `DATABASE_PORT`). If your consuming app expects a different set of environment variable names, pass individual connection properties from the AppHost:
Expand Down
Loading