Aspire.Hosting.SqlServer 13.6.1
SQL Server hosting integration
Use this integration to model, configure, and orchestrate a SQL Server database resource in an Aspire solution.
Getting started
Add the integration
From your AppHost directory, add the Aspire.Hosting.SqlServer integration with the Aspire CLI:
aspire add Aspire.Hosting.SqlServer
Usage example
In the AppHost, add a SQL Server resource and reference it from another resource with either C# or TypeScript:
C#
var db = builder.AddSqlServer("sql").AddDatabase("db");
var myService = builder.AddProject<Projects.MyService>()
.WithReference(db);
TypeScript
const db = await builder.addSqlServer("sql").addDatabase("db");
const myService = await builder.addNodeApp("myService", "../my-service", "server.js")
.withReference(db);
SQL REPL
Call WithRepl() to opt into a REPL command on the SQL Server resource in the dashboard:
builder.AddSqlServer("sqlserver").WithRepl();
await builder.addSqlServer("sqlserver").withRepl();
REPL access is disabled by default and is available only in run mode. Enable it only for trusted dashboard
users: 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 users who can execute resource commands.
Use QUIT before closing the terminal tab to end the session cleanly. Closing the tab alone can
leave sqlcmd running inside the container. Stopping the container also ends any remaining REPL processes.
While the container is running, the command opens sqlcmd in the terminal dock. It connects inside the container as sa to the master database, using the configured password without putting it in command-line arguments. No local SQL client installation is required.
Enter SQL statements followed by GO on its own line to execute a batch:
SELECT DB_NAME();
GO
Use USE [db]; followed by GO to switch databases, and QUIT to exit. The command trusts the local server's self-signed certificate, matching the integration's local connection string.
The REPL 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. This command is available only in run mode and uses the configured Docker or Podman runtime.
Connection Properties
When you reference a SQL Server resource using WithReference, the following connection properties are made available to the consuming project:
SQL Server server
The SQL Server server resource exposes the following connection properties:
| Property Name | Description |
|---|---|
Host |
The hostname or IP address of the SQL Server |
Port |
The port number the SQL Server is listening on |
Username |
The username for authentication |
Password |
The password for authentication |
Uri |
The connection URI in mssql:// format, with the format mssql://{Username}:{Password}@{Host}:{Port} |
JdbcConnectionString |
JDBC-format connection string, with the format jdbc:sqlserver://{Host}:{Port};trustServerCertificate=true. User and password credentials are provided as separate Username and Password properties. |
SQL Server database
The SQL Server database resource inherits all properties from its parent SqlServerServerResource and adds:
| Property Name | Description |
|---|---|
Uri |
The connection URI in mssql:// format, with the format mssql://{Username}:{Password}@{Host}:{Port}/{DatabaseName} |
JdbcConnectionString |
JDBC connection string with database name, with the format jdbc:sqlserver://{Host}:{Port};trustServerCertificate=true;databaseName={DatabaseName}. User and password credentials are provided as separate Username and Password properties. |
DatabaseName |
The name of the database |
Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called db1 becomes DB1_URI.
Additional documentation
https://aspire.dev/integrations/gallery/ https://aspire.dev/integrations/databases/sql-server/sql-server-host/
Feedback & contributing
No packages depend on Aspire.Hosting.SqlServer.
.NET 10.0
- Aspire.Hosting (>= 13.6.1)
- AspNetCore.HealthChecks.SqlServer (>= 9.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Google.Protobuf (>= 3.36.1)
- Grpc.AspNetCore (>= 2.83.0)
- Grpc.Net.ClientFactory (>= 2.83.0)
- Grpc.Tools (>= 2.83.0)
- Hex1b (>= 0.168.0)
- KubernetesClient (>= 19.0.2)
- MessagePack (>= 2.5.302)
- Microsoft.Bcl.Cryptography (>= 10.0.12)
- Microsoft.Data.SqlClient (>= 7.0.2)
- Microsoft.Extensions.Caching.Memory (>= 10.0.12)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.12)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Http (>= 10.0.12)
- Microsoft.Extensions.Logging (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Primitives (>= 10.0.12)
- ModelContextProtocol (>= 1.4.1)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- Polly.Core (>= 8.7.0)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.IO.Hashing (>= 10.0.12)
- System.Security.Cryptography.Pkcs (>= 10.0.12)
- YamlDotNet (>= 18.1.0)
.NET 8.0
- Aspire.Hosting (>= 13.6.1)
- AspNetCore.HealthChecks.SqlServer (>= 9.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Google.Protobuf (>= 3.36.1)
- Grpc.AspNetCore (>= 2.83.0)
- Grpc.Net.ClientFactory (>= 2.83.0)
- Grpc.Tools (>= 2.83.0)
- Hex1b (>= 0.168.0)
- KubernetesClient (>= 19.0.2)
- MessagePack (>= 2.5.302)
- Microsoft.Bcl.Cryptography (>= 10.0.12)
- Microsoft.Data.SqlClient (>= 7.0.2)
- Microsoft.Extensions.Caching.Memory (>= 10.0.12)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.31)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Http (>= 10.0.12)
- Microsoft.Extensions.Logging (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Primitives (>= 10.0.12)
- ModelContextProtocol (>= 1.4.1)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- Polly.Core (>= 8.7.0)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.Formats.Asn1 (>= 10.0.12)
- System.IO.Hashing (>= 10.0.12)
- System.Security.Cryptography.Pkcs (>= 10.0.12)
- System.Text.Json (>= 10.0.12)
- YamlDotNet (>= 18.1.0)
.NET 9.0
- Aspire.Hosting (>= 13.6.1)
- AspNetCore.HealthChecks.SqlServer (>= 9.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Google.Protobuf (>= 3.36.1)
- Grpc.AspNetCore (>= 2.83.0)
- Grpc.Net.ClientFactory (>= 2.83.0)
- Grpc.Tools (>= 2.83.0)
- Hex1b (>= 0.168.0)
- KubernetesClient (>= 19.0.2)
- MessagePack (>= 2.5.302)
- Microsoft.Bcl.Cryptography (>= 10.0.12)
- Microsoft.Data.SqlClient (>= 7.0.2)
- Microsoft.Extensions.Caching.Memory (>= 10.0.12)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 9.0.20)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Http (>= 10.0.12)
- Microsoft.Extensions.Logging (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Primitives (>= 10.0.12)
- ModelContextProtocol (>= 1.4.1)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- Polly.Core (>= 8.7.0)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.Formats.Asn1 (>= 10.0.12)
- System.IO.Hashing (>= 10.0.12)
- System.Security.Cryptography.Pkcs (>= 10.0.12)
- System.Text.Json (>= 10.0.12)
- YamlDotNet (>= 18.1.0)
| Version | Downloads | Last updated |
|---|---|---|
| 13.6.1 | 5 | 10/08/2026 |
| 13.6.0 | 9 | 09/30/2026 |
| 13.5.4 | 15 | 09/16/2026 |
| 13.5.3 | 16 | 08/27/2026 |
| 13.5.2 | 14 | 08/22/2026 |
| 13.5.1 | 17 | 08/20/2026 |
| 13.5.0 | 15 | 08/19/2026 |
| 13.4.6 | 25 | 06/22/2026 |
| 13.4.5 | 26 | 06/18/2026 |
| 13.4.4 | 27 | 06/15/2026 |
| 13.4.3 | 17 | 06/11/2026 |
| 13.4.2 | 31 | 06/04/2026 |
| 13.4.1 | 21 | 06/04/2026 |
| 13.4.0 | 25 | 06/05/2026 |
| 13.3.5 | 28 | 05/23/2026 |
| 13.3.4 | 26 | 05/20/2026 |
| 13.3.3 | 29 | 05/20/2026 |
| 13.3.2 | 33 | 05/16/2026 |
| 13.3.1 | 28 | 05/14/2026 |
| 13.3.0 | 28 | 05/10/2026 |
| 13.2.4 | 37 | 04/27/2026 |
| 13.2.3 | 32 | 04/22/2026 |
| 13.2.2 | 32 | 04/12/2026 |
| 13.2.1 | 33 | 04/01/2026 |
| 13.2.0 | 35 | 03/24/2026 |
| 13.1.3 | 35 | 03/22/2026 |
| 13.1.2 | 45 | 02/27/2026 |
| 13.1.1 | 44 | 02/15/2026 |
| 13.1.0 | 48 | 12/18/2025 |
| 13.0.2 | 45 | 12/11/2025 |
| 13.0.1 | 3 | 09/28/2026 |
| 13.0.0 | 48 | 12/14/2025 |
| 9.5.2 | 45 | 12/18/2025 |
| 9.5.1 | 2 | 10/02/2026 |
| 9.5.0 | 36 | 12/12/2025 |
| 9.4.2 | 38 | 12/12/2025 |
| 9.4.1 | 2 | 10/01/2026 |
| 9.4.0 | 3 | 10/07/2026 |
| 9.3.2 | 35 | 12/14/2025 |
| 9.3.1 | 31 | 12/11/2025 |
| 9.3.0 | 32 | 01/01/2026 |
| 9.2.1 | 29 | 12/23/2025 |
| 9.2.0 | 40 | 12/12/2025 |
| 9.1.0 | 32 | 12/11/2025 |
| 9.0.0 | 33 | 12/11/2025 |
| 9.0.0-rc.1.24511.1 | 35 | 12/11/2025 |
| 8.2.2 | 35 | 12/29/2025 |
| 8.2.1 | 38 | 12/11/2025 |
| 8.2.0 | 32 | 01/01/2026 |
| 8.1.0 | 1 | 10/08/2026 |
| 8.0.2 | 37 | 12/28/2025 |
| 8.0.1 | 34 | 12/12/2025 |
| 8.0.0 | 31 | 12/14/2025 |
| 8.0.0-preview.7.24251.11 | 37 | 12/12/2025 |
| 8.0.0-preview.6.24214.1 | 34 | 12/13/2025 |
| 8.0.0-preview.5.24201.12 | 33 | 12/19/2025 |