Skip to content

Copy-DbaLinkedServer - Add DAC connection to prevent multiple DAC connection attempts#9921

Merged
potatoqualitee merged 1 commit intodevelopmentfrom
claude/issue-9204-20251103-1650
Nov 3, 2025
Merged

Copy-DbaLinkedServer - Add DAC connection to prevent multiple DAC connection attempts#9921
potatoqualitee merged 1 commit intodevelopmentfrom
claude/issue-9204-20251103-1650

Conversation

@andreasjordan
Copy link
Collaborator

Summary

This PR fixes issue #9204 where Sync-DbaAvailabilityGroup was causing 3 failed DAC connection errors in SQL Server logs.

Root Cause

Copy-DbaLinkedServer was not opening a DAC connection like Copy-DbaCredential does. When Get-DecryptedObject was called without an existing DAC connection, it attempted to open its own DAC connection, causing conflicts when both credentials and linked servers needed to be synced.

Changes

  • Added -DedicatedAdminConnection parameter to Connect-DbaInstance call in Copy-DbaLinkedServer.ps1 (line 286)
  • Added verbose message about opening DAC connection (line 285)
  • Added end block to properly disconnect DAC connection (lines 322-326)

This ensures Copy-DbaLinkedServer follows the same pattern as Copy-DbaCredential, opening a DAC connection upfront that Get-DecryptedObject will detect and reuse.

Fixes #9204

🤖 Generated with Claude Code

…nection attempts

This fix addresses issue #9204 where Sync-DbaAvailabilityGroup was causing 3 failed DAC connection errors in SQL Server logs.

Root cause: Copy-DbaLinkedServer was not opening a DAC connection like Copy-DbaCredential does. When Get-DecryptedObject was called without an existing DAC connection, it attempted to open its own DAC connection, causing conflicts when both credentials and linked servers needed to be synced.

Changes:
- Added -DedicatedAdminConnection parameter to Connect-DbaInstance call (line 286)
- Added verbose message about opening DAC connection (line 285)
- Added end block to properly disconnect DAC connection (lines 322-326)

This ensures Copy-DbaLinkedServer follows the same pattern as Copy-DbaCredential, opening a DAC connection upfront that Get-DecryptedObject will detect and reuse.

Co-authored-by: Andreas Jordan <[email protected]>
@potatoqualitee
Copy link
Member

LGTM! Thank you, Andreas 🙏🏼

@potatoqualitee potatoqualitee merged commit 40c7168 into development Nov 3, 2025
15 checks passed
@potatoqualitee potatoqualitee deleted the claude/issue-9204-20251103-1650 branch November 3, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 DAC errors reporting in SQL logs / Application Event Log.

2 participants