Password decryption commands - Document the remote DAC prerequisite - #10551
Password decryption commands - Document the remote DAC prerequisite#10551andreasjordan wants to merge 2 commits into
Conversation
Up to dbatools 2.7, Get-DecryptedObject opened a local DAC itself from inside the PowerShell remoting session on the SQL Server host, so no remote DAC was needed. PR #10174 removed that path so a single DAC can be opened early and shared, because SQL Server allows only one DAC per instance. That refactor was deliberate, but it changed the network requirement from "PowerShell remoting only" to "PowerShell remoting plus a reachable remote DAC", and nothing in the help said so. Documents the current state in the eight affected commands and in Get-DecryptedObject: what the two connections are, that the DAC is opened from the client and therefore needs remote admin connections enabled and a reachable DAC port, and that -ExcludePassword avoids both. Also corrects two statements that no longer hold: - Copy-DbaCredential claimed "DAC access enabled for local (default)" - Export-DbaLinkedServer said it "accesses the local registry" No behaviour change - help only. Whether the code should also regain a local-DAC path is the open question on the issue, deliberately not answered here. Refs #10549 (do Copy-DbaCredential, Copy-DbaDbMail, Copy-DbaLinkedServer, Export-DbaCredential, Export-DbaInstance, Export-DbaLinkedServer, Start-DbaMigration, Sync-DbaAvailabilityGroup) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
VerdictRequest changes. The documentation-only approach is reasonable, and the underlying DAC-sharing logic is sound, but the current wording contains three factual problems. I would not merge it as written. Findings1. Blocking: remote DAC and PowerShell remoting are not always requiredEvery new description effectively says:
That is only true when the command runs on a different computer from the SQL Server host.
Consequently, when these commands run directly on the SQL Server host:
This affects the wording added to all eight public commands and the internal This is worth blocking because the current text could cause administrators to enable remote DAC unnecessarily, even though Microsoft recommends leaving remote administration connections disabled unless they are specifically required. ([Microsoft Learn]1) 2. Blocking: the DAC port is not determined by default versus named instanceThe repeated wording says:
That split is inaccurate. SQL Server listens for the DAC on TCP 1434 when that port is available. Otherwise, it assigns a TCP port during startup. This can happen to a default instance too, and the SQL Server error log is the authoritative source for the active DAC port. ([Microsoft Learn]2) SQL Server Browser is a separate discovery mechanism using UDP 1434. The actual DAC endpoint remains a TCP port. The current wording risks sending an administrator to the wrong port or causing confusion between TCP 1434 and UDP 1434. ([Microsoft Learn]3) 3. Medium: the
|
…nal on running remotely Reworks the help added in this PR along the lines of the review: - Remote admin connections, a reachable DAC port and PowerShell remoting are only needed when the command runs on a different machine than the SQL Server host. Connect-DbaInstance uses ADMIN:localhost and Invoke-Command2 runs locally when the target is local, so running on the host itself needs neither. The help now says so instead of presenting the remote path as unconditional. - The DAC port split "TCP 1434 for default, Browser-published for named" was wrong. SQL Server listens on TCP 1434 when that port is available and otherwise assigns a port at startup; the error log names the active port. The help now states that and drops the Browser claim. - The Set-DbaSpConfigure example now includes -SqlInstance, without which it changes nothing. - Stale prerequisites reconciled: Copy-DbaCredential no longer lists Windows administrator access unconditionally, and Copy-DbaLinkedServer no longer claims the destination needs Windows access. - Added the SQL Server Express caveat: no DAC without trace flag 7806. The three orchestrators keep a short version and point at the leaf commands for the full prerequisites, so the corrected details live in one place per command family. Still help only - no behaviour change. Refs #10549 (do Copy-DbaCredential, Copy-DbaDbMail, Copy-DbaLinkedServer, Export-DbaCredential, Export-DbaInstance, Export-DbaLinkedServer, Start-DbaMigration, Sync-DbaAvailabilityGroup) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for the thorough review — all four findings were correct, and all are addressed in the latest commit.
The Express trace flag 7806 caveat is also added to the five leaf commands. The orchestrators keep a short version and defer the full prerequisites to the leaf commands, so the details live in one place per family. This response was created by Claude and reviewed by Andreas Jordan. |
Draft, to show what the documentation-only option from #10549 actually looks like. The design question on that issue is still open — this PR deliberately does not answer it.
Problem
Up to dbatools 2.7,
Get-DecryptedObjectopened the DAC itself, from inside the PowerShell remoting session on the SQL Server host (ADMIN:127.0.0.1\<instance>). That is a local DAC: it needs neitherremote admin connectionsnor a reachable DAC port.PR #10174 removed that path so that a single DAC can be opened early and shared across every command that needs one — SQL Server allows only one DAC per instance, and the per-command open/close pattern was the root of #10040, #9921 and #10475.
The refactor was intended. The side effect was not documented: the requirement changed from "PowerShell remoting to the host" to "PowerShell remoting plus a remote DAC". Reporters hit this as a silent failure, most recently in #10549.
What changed
Help only — no behaviour change, no code touched.
Added to the
.DESCRIPTIONof the five commands that decrypt passwords directly (Export-DbaLinkedServer,Export-DbaCredential,Copy-DbaLinkedServer,Copy-DbaCredential,Copy-DbaDbMail) a short block naming both connections:The three orchestrators (
Export-DbaInstance,Start-DbaMigration,Sync-DbaAvailabilityGroup) get a shorter version that also states they open one shared DAC and hand it down, and points at the underlying commands.Sync-DbaAvailabilityGroupalready explained the shared DAC; only the network prerequisite was missing.Every
-ExcludePasswordparameter now says it is also the way out when the DAC or remoting is unavailable, since the command then needs neither.Get-DecryptedObjectrecords why it no longer opens a DAC itself, so the next person to read it does not have to reconstruct the history from git.Two statements that are no longer true are corrected:
Copy-DbaCredentiallistedDAC access enabled for local (default)underRequires:— the opposite of what it needs nowExport-DbaLinkedServersaid it "accesses the local registry"; the registry read happens on the SQL Server host, not locallyWhat deliberately did not change
No code. Whether
Get-DecryptedObjectshould regain a local-DAC-over-remoting path is the question put to contributors on #10549. Reintroducing a second DAC path costs reliability in an area that took several releases to stabilise, so it should be a decision, not a side effect of this PR.Invoke-DbaDbDecryptObjectalso opens a DAC but is untouched — it needs one for the encrypted object definitions themselves and has no remoting leg to route through, so the requirement there is inherent rather than a consequence of the refactor.Testing
Get-Helprenders the new text on all 8 commandsReported and diagnosed by @edbmfo in #10549, whose analysis of the
127.0.0.1change and its removal was correct in every detail.