You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dacConnected check in multiple commands was checking Server.Name for the ADMIN:
prefix, but the ADMIN: prefix lives in ConnectionContext.ServerInstance. Since Server.Name
never starts with ADMIN:, the check always returned false - causing commands to mark
$dacOpened = $true and disconnect the shared DAC connection at their end blocks.
This resulted in Sync-DbaAvailabilityGroup's DAC being unintentionally closed by each
sub-command (Copy-DbaCredential, Copy-DbaDbMail, Copy-DbaLinkedServer).
Additionally, Sync-DbaLoginPermission was passed the DAC server object. Update-SqlPermission
calls SqlConnectionObject.Close() in tight loops (per role per database per login), causing
repeated DAC slot acquire/release cycles that trigger "max 1 DAC connections" SQL errors.
Fixes:
- Change all dacConnected checks from .InputObject.Name to
.InputObject.ConnectionContext.ServerInstance (or .Parent.ConnectionContext.ServerInstance)
- In Sync-DbaAvailabilityGroup, pass DomainInstanceName string to Sync-DbaLoginPermission
so it opens a normal pooled connection instead of reusing the DAC server
Fixes#10284
(do *AvailabilityGroup*, *Credential*, *LinkedServer*, *DbMail*, *Migration*, *Decrypt*)
Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
Stop-Function-Message "Pipeline source must use a dedicated admin connection to retrieve passwords. Use -ExcludePassword to bypass this requirement if you don't need passwords."
@@ -399,7 +399,18 @@ function Sync-DbaAvailabilityGroup {
0 commit comments