dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

[Copy-DbaCredential] Failed to decrypt credentials on

Open ksl28 opened this issue 2 years ago • 0 comments

Verified issue does not already exist?

Yes

What error did you receive?

PSMessageDetails : Exception : System.Exception: Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is config ured to allow remote connections. (provider: SQL Network Interfaces, error: 43 - An error occurred while obtaining the dedicated administrator connection (DAC) port. Make sure that SQL Browser is running, or check the error log for the port number)" ---> System.Management.Automation.RemoteException: Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is cor rect and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 43 - An error occurred while obtaining the dedicated administrator connection (DAC) port. Make sure that SQL Browser is running, or check the error log for the port number)" at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) --- End of inner exception stack trace --- TargetObject : dk1sql01 CategoryInfo : NotSpecified: (dk1sql01:PSObject) [Write-Error], Exception FullyQualifiedErrorId : dbatools_Get-DecryptedObject,Stop-Function ErrorDetails : Exception calling "Open" with "0" argument(s): "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remo te connections. (provider: SQL Network Interfaces, error: 43 - An error occurred while obtaining the dedicated administrator connection (DAC) port. Make sure that SQL Browser is running, or check the error log for the port number)" InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Stop-Function, C:\Users\ksladm\Documents\PowerShell\Modules\dbatools\1.1.95\allcommands.ps1: line 147768 at Get-DecryptedObject, C:\Users\ksladm\Documents\PowerShell\Modules\dbatools\1.1.95\allcommands.ps1: line 139060 at Copy-DbaLinkedServers, C:\Users\ksladm\Documents\PowerShell\Modules\dbatools\1.1.95\allcommands.ps1: line 13183 at Copy-DbaLinkedServer<Process>, C:\Users\ksladm\Documents\PowerShell\Modules\dbatools\1.1.95\allcommands.ps1: line 13361 at Sync-DbaAvailabilityGroup<End>, C:\Users\ksladm\Documents\PowerShell\Modules\dbatools\1.1.95\allcommands.ps1: line 124702 at <ScriptBlock>, <No file>: line 4 PipelineIterationInfo : {0, 1}

Steps to Reproduce

$Master = "dk1sql01"
$Secondary = "dk1sql02"
$AGGroup = "dk1sqlclu01ag02"
Sync-DbaAvailabilityGroup -Primary $Master -Secondary $Secondary.name -AvailabilityGroup $AGGroup

Are you running the latest release?

Yes

Other details or mentions

The SQL Servers only holds 1 SQL instance, so the SQL Browser is disabled. But it looks like Sync-DbaAvailabilityGroup invokes Copy-DbaCredential during the copying of SQL Credentials, and that Copy-DbaCredential expect the DAC / SQL Server browser to be active. DBAError

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

PSVersion 7.2.3 PSEdition Core GitCommitId 7.2.3 OS Microsoft Windows 10.0.20348 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

SQL Server Edition and Build number

Microsoft SQL Server 2019 (RTM-CU15) (KB5008996) - 15.0.4198.2 (X64) Jan 12 2022 22:30:08 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2022 Standard 10.0 <X64> (Build 20348: ) (Hypervisor)

.NET Framework Version

.NET 6.0.4

ksl28 avatar May 16 '22 10:05 ksl28