Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Test-DbaDbCompatability uses Credential parameter and fails when a SQL Cred is passed #5666

Closed
SQLDBAWithABeard opened this issue May 31, 2019 · 1 comment

Comments

@SQLDBAWithABeard
Copy link
Contributor

SQLDBAWithABeard commented May 31, 2019

So I am looking at getting dbachecks running on Core (shhh ;-) ) and got this error when using SqlAuth for Test-DbaDbCompatability

Environmental information

#### PowerShell version:

Name                           Value                                                                                                                     
----                           -----                                                                                                                     
PSVersion                      5.1.17763.503                                                                                                             
PSEdition                      Desktop                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                   
BuildVersion                   10.0.17763.503                                                                                                            
CLRVersion                     4.0.30319.42000                                                                                                           
WSManStackVersion              3.0                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                       
SerializationVersion           1.1.0.1                                                                                                                   




#### dbatools Module version:


Name    : dbatools
Path    : C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.821\dbatools.psd1
Version : 0.9.821
#### PowerShell version:

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Microsoft Windows 10.0.17763 
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0b

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Linux 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0



#### dbatools Module version:

Name    : dbatools
Path    : /home/robadmin/.local/share/powershell/Modules/dbatools/0.9.828/dbatools.psd1
Version : 0.9.828

#### SQL Server: 

Microsoft SQL Server 2017 (RTM-CU11) (KB4462262) - 14.0.3038.14 (X64)
        Sep 14 2018 13:53:44
        Copyright (C) 2017 Microsoft Corporation
        Developer Edition (64-bit) on Linux (Ubuntu 16.04.5 LTS)

Report

Errors Received

writeErrorStream      : True
PSMessageDetails      : 
Exception             : System.Exception: The target principal name is incorrect.  Cannot generate SSPI context. ---> 
                        System.Data.SqlClient.SqlException: The target principal name is incorrect.  Cannot generate SSPI context.
                           at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString 
                        connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean 
                        redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, 
                        String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
                           at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, 
                        Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
                           at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, 
                        DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
                           at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, 
                        DbConnectionInternal oldConnection)
                           at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, 
                        DbConnectionInternal oldConnection)
                           at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 
                        waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, 
                        DbConnectionInternal& connection)
                           at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, 
                        DbConnectionOptions userOptions, DbConnectionInternal& connection)
                           at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, 
                        DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
                           at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory 
                        connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
                           at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
                           at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
                           at System.Data.SqlClient.SqlConnection.Open()
                           at CallSite.Target(Closure , CallSite , Object )
                           --- End of inner exception stack trace ---
TargetObject          : localhost,15591
CategoryInfo          : ConnectionError: (localhost,15591:PSObject) [Write-Error], Exception
FullyQualifiedErrorId : dbatools_Test-DbaDbCompatibility,Stop-Function
ErrorDetails          : The target principal name is incorrect.  Cannot generate SSPI context.
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Stop-Function, C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.821\allcommands.ps1: line 109975
                        at Test-DbaDbCompatibility<Process>, C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.821\allcommands.ps1: line 101047
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

Steps to Reproduce

Running

Test-DbaDbCompatibility -SqlInstance 'localhost,15591' -Credential sqladmin

returns the error above. Tested on PS 5.1, 6.2 and on WSL

Set the credential to $SQLCredential and command succeeds

WSL
image

6.2

image

5.1

image

Expected Behavior

Should work with SqlCredential

Actual Behavior

Error as above!

potatoqualitee added a commit that referenced this issue Jun 7, 2019
@potatoqualitee
Copy link
Member

thanks for the solution, will be fixed in 1.0

potatoqualitee added a commit that referenced this issue Jun 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants