Skip to content

Issues with DAC connection #10040

@Phaere

Description

@Phaere

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

Could not connect because the maximum number of '1' dedicated administrator connections already exists. Before a new connection can be made, the existing dedicated administrator connection must be dropped, either by logging off or ending the process

Steps to Reproduce

Issue 1:
Running Export-DbaLinkedServer -SqlInstance SRV will result in error mentioned above in server logs.
As described in #9921 we should open DAC connection before calling Get-DecryptedObject, so Export-DbaLinkedServer should open DAC connection too?
Issue 2:
After #9921 merged, Copy-DbaLinkedServer will always try to open DAC connection despite of "-ExcludePasswords" parameter. Should we check this parameter before opening connection?
Issue 3:
Root issue of error above is that System.Data.SqlClient.SQLConnection tries to connect to all IP's simultaneously.
So when we try to open DAC connection in Get-DecryptedObject it opens in "Invoke-Command2" function and executes on source server locally. Locally we have multiple IP's per server by default (local, ipv6, ipv4 etc) and DAC connection tries to open multiple times to each ip simultaneously

Please confirm that you are running the most recent version of dbatools

Major Minor Build Revision


2 7 13 -1

Other details or mentions

I don't found how i can limit this behavior of System.Data.SqlClient.SQLConnection, so maybe DAC connection should perform directly to IP instead of DNS name if it connects to local machine?

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.20348.4294
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.4294
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2016 (SP3-GDR) (KB5058718) - 13.0.6460.7 (X64) May 29 2025 21:37:21 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2022 Datacenter 10.0 (Build 20348: )

.NET Framework Version

PSChildName Version


Client 4.8.04161
Full 4.8.04161
Client 4.0.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugs lifetriage requiredNew issue that has not been reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions