Database names with spaces cause firewall detection to fail - sqlcmd argument not quoted
@dzsquared is already working on this.
Since Jan 20, 2026.
Assessment
This issue has not been assessed yet.
Description
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/sql-action@v2.3runs-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()"
- Dominant language
- TypeScript
- Stars
- 142
- Forks
- 73
- Avg merge
- 9d 18h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/sql-action
-
need-to-triage
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Azure/sql-action#247 ·
-
need-to-triage
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Azure/sql-action#282 ·
-
need-to-triage
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Azure/sql-action#262 · 1 comment ·
-
need-to-triage
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Azure/sql-action#261 ·
-
need-to-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Azure/sql-action#256 · 1 comment ·
All issues in Azure/sql-action
Similar issues
-
blocklist removal
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pastelsky/bundlephobia#1122 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100