Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Database names with spaces cause firewall detection to fail - sqlcmd argument not quoted

未关闭
#267 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@dzsquared 已经在做这个了。

开始于 2026年1月20日。

  • #268 来自 @dzsquared —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

bug

When the connection string contains a database name with a space (e.g. Initial Catalog=MyDatabase Live), the firewall IP detection step fails because the database name is not properly quoted when passed to sqlcmd.

Error:

Failed to add firewall rule. Unable to detect client IP Address. Sqlcmd: 'Live': Unknown command. Enter '--help' for command help.

Debug output:

##[debug]Validating if client has access to 'MyDatabase Live' on 'myserver.database.windows.net'.
##[debug]The process 'sqlcmd' failed with exit code 1
##[debug]SqlCmd stderr: Sqlcmd: 'Live': Unknown command. Enter '--help' for command help.

The action correctly parses the database name as MyDatabase Live, but fails to quote it when executing sqlcmd.

Environment:

  • azure/[email protected]
  • runs-on: ubuntu-latest
  • Azure SQL Database with Authentication=Active Directory Default

Connection string:

Server=myserver.database.windows.net;Initial Catalog=MyDatabase Live;Authentication=Active Directory Default;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

Attempted workarounds (none worked):

  • Single quotes: Initial Catalog='MyDatabase Live'
  • Double quotes: Initial Catalog="MyDatabase Live"

Potential root cause:

The detectIPAddress function extracts the database name correctly but may pass it to sqlcmd as the -d argument without quoting, resulting in:

sqlcmd -S myserver.database.windows.net -d MyDatabase Live -Q "select getdate()"

Expected behaviour:

sqlcmd -S myserver.database.windows.net -d "MyDatabase Live" -Q "select getdate()"
主要语言
TypeScript
星标
142
派生
73
平均合并
3 天 3 分钟
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/sql-action 的其他 Issue

查看 Azure/sql-action 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。