You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SQL Server's dashboard REPL failing to launch from Windows checkouts. The embedded /bin/sh script retained CRLF line endings and failed with Syntax error: "elif" unexpected, sometimes leaving the dashboard showing "Terminal view is not connected."
Launch /opt/mssql-tools18/bin/sqlcmd directly, matching the default SQL Server image. Add an optional Action<SqlServerReplOptions> callback and SqlServerReplCommand.Version17 / Version18 path constants so older or custom images can select an installed client or an executable wrapper script. Preserve the existing parameterless C# overload and generated TypeScript withRepl() call.
The README includes version overrides, custom paths, and before/after wrapper scripts. Tests cover defaults, configuration capture, invalid commands, run/publish behavior, credential forwarding, and authenticated SQL execution. Committed TypeScript codegen coverage compiles the callback, command accessors, version constants, and custom paths across npm, Bun, Yarn, and pnpm, and rejects numeric command versions.
Command also accepts a custom executable path such as /usr/local/bin/sqlcmd-wrapper. It does not install tools or modify the container image.
Breaking changes
Older SQL Server images that only contain /opt/mssql-tools/bin/sqlcmd no longer get automatic client-path discovery. Those AppHosts must select SqlServerReplCommand.Version17 explicitly. The default image and parameterless API remain supported.
Security considerations
The existing opt-in, run-only REPL still authenticates as sa and should only be enabled for trusted dashboard users. The executable override is AppHost-authored configuration and runs inside the existing container with the sqlcmd arguments. No shell interprets the command or arguments, and SQLCMDPASSWORD remains an environment variable rather than a command-line argument. Custom wrapper scripts receive that environment and must avoid logging credentials.
Validation
Runtime-tested commit: 475b2624dee66923ce452deba5dd1b2f86f2a045. Packaged CLI, templates, and integrations: 17.0.0-pr.20704.g475b2624.
CI passed, including stabilization, package builds, SQL Server tests on Windows/Linux, and TypeScript API compatibility. A Linux ARM64 hosted runner lost communication with GitHub; its automatic retry passed.
Windows source tests: 165 passed, zero failures or skips: SQL Server REPL/public API 49, MongoDB 30, PostgreSQL 23, MySQL 23, Redis 20, Valkey 20. These include real authenticated terminal sessions, MongoDB replica-set/TLS variants, and PostgreSQL/MySQL alternate ports. Quarantine and outerloop scenarios were excluded.
Fresh PR-artifact C# AppHost, Windows host with Docker Desktop Linux containers, actual Edge dashboard REPLs: SQL Server, MongoDB, PostgreSQL, MySQL, Redis, and Valkey all accepted input, returned the expected authenticated query result or PONG, and exited cleanly. Default MongoDB and Redis TLS configurations were exercised.
SQL Server Version17 worked with the real 2022-CU13-ubuntu-22.04 image. The README Dockerfile/wrapper example ran both its pre-session and post-session work around an authenticated SQL session.
Fresh TypeScript AppHost: the generated callback read the default Version18 command, set Version17, and opened a working legacy-client SQL session through the dashboard.
Stopped-resource negative case: the dashboard disabled REPL, and direct CLI invocation failed with The container is not running. and exit code 16.
Temporary AppHosts, containers, isolated CLI/hive, and tooling were cleaned up; logs, terminal snapshots, screenshots, and fixture sources were retained locally.
Follow-up at a3c214e9c5f4538decfb72079bdc01377e09b4ce:
Merged origin/main through 810d40942cd18ec3e6c47ee0fdeaacc44d6c7c97 without conflicts. Rebuilt and passed 49 SQL Server REPL/public API tests and 33 dashboard terminal tests on Windows.
Added committed TypeScript generated-SDK regression coverage. All four toolchains passed on Windows with Docker Desktop Linux containers, using the exact native CLI/package artifacts 17.0.0-pr.20704.g475b2624. The SQL Server implementation is unchanged by the follow-up test commit. Local setup required the native bundle rather than the CLI-only archive, the root-level CLI package metadata used by CI, and LocalArchive installation rather than the PR-mode activation path. No production or test-harness workaround was added.
CI for the updated branch is running; the earlier successful CI result above applies to the earlier runtime-tested commit.
Checklist
Is this feature complete?
Yes. Ready to ship.
No. Follow-up changes expected.
Are you including unit tests for the changes and scenario tests if relevant?
Yes
No
Did you add public API?
Yes
If yes, did you have an API Review for it?
Yes
No
Did you add <remarks /> and <code /> elements on your triple slash comments?
Yes
No
No
Does the change make any security assumptions or guarantees?
Yes
If yes, have you done a threat model and had a security review?
Launch sqlcmd directly instead of parsing a checkout-dependent shell script. Add configurable executable paths and well-known client commands, with C# and TypeScript documentation and coverage.
Fixes#20645
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Avoid introducing a namespace that shadows Azure.Provisioning.Sql.SqlServer and keep shared image metadata independent of the hosting assembly.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This does not satisfy the linked issue's failure-diagnostics requirement. If this configured path is absent or not executable (notably when an older image is used without the new override), docker exec can still end before a viewer attaches; Hex1bAspireTerminal.RunTerminalAsync logs exceptions and cancellation but no normal workload completion or exit status, so the dashboard can still show only the generic disconnected state. Add observable launch/completion diagnostics (including exit status when available), or do not close #20645 as fully fixed.
The reason will be displayed to describe this comment to others. Learn more.
No additional high-confidence findings. Repository restore succeeded, and all 31 focused SQL Server REPL tests passed locally, including authenticated container sessions.
The broader terminal launch/completion diagnostics mentioned in the Copilot review summary are out of scope for this PR. We're working on enhancements upstream in Hex1b and will handle that work separately. This PR is focused on fixing the SQL Server REPL launch on Windows.
Type-check default and configured REPL calls, command get/set, version constants, custom paths, and rejection of numeric versions across npm, Bun, Yarn, and pnpm.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…apper scripts
Documents changes from microsoft/aspire#20704: the REPL now invokes
/opt/mssql-tools18/bin/sqlcmd directly instead of probing for a client,
adds SqlServerReplOptions/SqlServerReplCommand to select Version17 for
older images or a custom executable path, and supports wrapper scripts
that run work before/after the interactive session.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Updated the SQL Server REPL documentation in sql-server-host.mdx to match PR #20704's behavior change: triggered signals container_image_tags_file_changed, integration_readme_changed, new_public_type, pr_body_has_user_facing_section, and pr_label_breaking_change.
Replaced the "supports both tools18/tools17" description with "invokes /opt/mssql-tools18/bin/sqlcmd directly" (per SqlServerContainerImageTags.cs and the README diff).
Added a Select the client executable section documenting the new SqlServerReplOptions/SqlServerReplCommand public types (Version17/Version18 constants) and a :::note[Breaking change] callout for older images that previously relied on auto-discovery, per the PR body's "Breaking changes" section.
Added a Run a wrapper script section with the Dockerfile/wrapper example from the README, including the SQLCMDPASSWORD env-var and exit-code guidance from the PR's security-considerations section.
All C#/TypeScript snippets use synced Tabs/TabItem with syncKey='aspire-lang', consistent with the rest of the page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area-integrationsIssues pertaining to Aspire Integrations packagesbreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix SQL Server's dashboard REPL failing to launch from Windows checkouts. The embedded
/bin/shscript retained CRLF line endings and failed withSyntax error: "elif" unexpected, sometimes leaving the dashboard showing "Terminal view is not connected."Launch
/opt/mssql-tools18/bin/sqlcmddirectly, matching the default SQL Server image. Add an optionalAction<SqlServerReplOptions>callback andSqlServerReplCommand.Version17/Version18path constants so older or custom images can select an installed client or an executable wrapper script. Preserve the existing parameterless C# overload and generated TypeScriptwithRepl()call.The README includes version overrides, custom paths, and before/after wrapper scripts. Tests cover defaults, configuration capture, invalid commands, run/publish behavior, credential forwarding, and authenticated SQL execution. Committed TypeScript codegen coverage compiles the callback, command accessors, version constants, and custom paths across npm, Bun, Yarn, and pnpm, and rejects numeric command versions.
Fixes #20645
User-facing usage
Existing calls use the default client:
Select the client installed in an older image:
Commandalso accepts a custom executable path such as/usr/local/bin/sqlcmd-wrapper. It does not install tools or modify the container image.Breaking changes
Older SQL Server images that only contain
/opt/mssql-tools/bin/sqlcmdno longer get automatic client-path discovery. Those AppHosts must selectSqlServerReplCommand.Version17explicitly. The default image and parameterless API remain supported.Security considerations
The existing opt-in, run-only REPL still authenticates as
saand should only be enabled for trusted dashboard users. The executable override is AppHost-authored configuration and runs inside the existing container with the sqlcmd arguments. No shell interprets the command or arguments, andSQLCMDPASSWORDremains an environment variable rather than a command-line argument. Custom wrapper scripts receive that environment and must avoid logging credentials.Validation
Runtime-tested commit:
475b2624dee66923ce452deba5dd1b2f86f2a045. Packaged CLI, templates, and integrations:17.0.0-pr.20704.g475b2624.PONG, and exited cleanly. Default MongoDB and Redis TLS configurations were exercised.Version17worked with the real2022-CU13-ubuntu-22.04image. The README Dockerfile/wrapper example ran both its pre-session and post-session work around an authenticated SQL session.Version18command, setVersion17, and opened a working legacy-client SQL session through the dashboard.The container is not running.and exit code 16.Follow-up at
a3c214e9c5f4538decfb72079bdc01377e09b4ce:origin/mainthrough810d40942cd18ec3e6c47ee0fdeaacc44d6c7c97without conflicts. Rebuilt and passed 49 SQL Server REPL/public API tests and 33 dashboard terminal tests on Windows.17.0.0-pr.20704.g475b2624. The SQL Server implementation is unchanged by the follow-up test commit. Local setup required the native bundle rather than the CLI-only archive, the root-level CLI package metadata used by CI, and LocalArchive installation rather than the PR-mode activation path. No production or test-harness workaround was added.Checklist
<remarks />and<code />elements on your triple slash comments?