Synapse / SQL Password so secure that even you cannot use

Published Feb 22 2021 07:23 AM 1,974 Views
Microsoft

 

Teaser card - security.PNG

Everyone knows that the your password should be very strong, and there companies that use password generator to create complex password and this is fine too. But sometimes or better saying in some conditions this can cause some connectivity issues

 

Important note on Security: To keep this article short and focused on the password itself, the sample code below uses passwords in connection string in clear text. This is strongly recommended against in production code. Any sensitive information like passwords should be stored as secrets in the Azure Key Vault.

 

 

Lets start using a free password generator I found on internet where I got something that looks like a good password "q3@yGfAm@JHM".

FonsecaSergio_0-1612824941391.png

 

Let me create a login + user using it TSQL below

 

 

 

 

 

 

--MASTER DB
CREATE LOGIN UserXPTO WITH PASSWORD = 'q3@yGfAm@JHM'

--USER DB
CREATE USER UserXPTO FOR LOGIN UserXPTO

 

 

 

 

 

 

Now let me try to connect to is using .NET SQLClient

 

 

 

 

 

Clear-Host

Write-Host "NATIVE CLIENT TEST" -ForegroundColor Green

$Server = "tcp:xxxxx.sql.azuresynapse.net,1433"
$Database = "dwpool"
$Username = "UserXPTO"
$Password = "q3@yGfAm@JHM"
$SQLText = "Select getdate() as NOW"

########################################################################################
$connectionTimeout = 15

$connectionString = "Server=$Server;"
$connectionString += "Initial Catalog=$Database;"
$connectionString += "User ID=$Username;"
$connectionString += "Password=""$Password"";"
$connectionString += "Connection Timeout=$($connectionTimeout);"
$connectionString += "Persist Security Info=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False"

$connection = New-Object -TypeName System.Data.SqlClient.SqlConnection($connectionString)

Write-Host "CurrentTime: $(((Get-Date).ToUniversalTime()).ToString("yyyy-MM-dd HH:mm:ss")) UTC"
Write-Host "Connection to Server ($($Server)) / DB ($($Database)) / UserName ($($Username))"

Try {
    $connection.open()
    Write-Host "Connection with success"

    $command = New-Object -TypeName System.Data.SqlClient.SqlCommand
    $command.CommandTimeout = 60
    $command.connection = $connection
    $command.CommandText = $SQLText

    $result = $command.ExecuteScalar()    
    Write-Host "Query success. Server currenttime ($($result))"
    $connection.Close()
}
Catch {
    Write-Error $_.Exception.Message
}

 

 

 

 

 

 

 

 

Results looks fine

NATIVE CLIENT TEST
CurrentTime: 2021-02-08 23:25:29 UTC
Connection to Server (tcp:xxxxx.sql.azuresynapse.net,1433) / DB (dwpool) / UserName (UserXPTO)
Connection with success
Query success. Server currenttime (02/08/2021 23:25:29)

 

Now let's move to ODBC (Current installed version 17.6.1.1) using basically same code

 

 

 

 

 

 

Clear-Host

Write-Host "ODBC CLIENT TEST" -ForegroundColor Green

$Server = "tcp:xxxxx.sql.azuresynapse.net,1433"
$Database = "dwpool"
$Username = "UserXPTO"
$Password = "q3@yGfAm@JHM"
$SQLText = "Select getdate() as NOW"

########################################################################################
$connectionTimeout = 15

$connectionString = "Driver={ODBC Driver 17 for SQL Server};"
$connectionString += "Server=$Server;"
$connectionString += "Database=$Database;"
$connectionString += "UID=$Username;"
$connectionString += "PWD=""$Password"";"
$connectionString += "Connection Timeout=$($connectionTimeout);"
$connectionString += "Encrypt=yes;TrustServerCertificate=no"

$connection = New-Object -TypeName System.Data.Odbc.OdbcConnection($connectionString)

Write-Host "CurrentTime: $(((Get-Date).ToUniversalTime()).ToString("yyyy-MM-dd HH:mm:ss")) UTC"
Write-Host "Connection to Server ($($Server)) / DB ($($Database)) / UserName ($($Username))"

Try {
    $connection.open()
    Write-Host "Connection with success"

    $command = New-Object System.Data.Odbc.OdbcCommand
    $command.CommandTimeout = 60
    $command.connection = $connection
    $command.CommandText = $SQLText

    $result = $command.ExecuteScalar()    
    Write-Host "Query success. Server currenttime ($($result))"
    $connection.Close()
}
Catch {
    Write-Error $_.Exception.Message
}

 

 

 

 

 

 

And now the results

 

ODBC CLIENT TEST
CurrentTime: 2021-02-08 23:26:13 UTC
Connection to Server (tcp:xxxxx.sql.azuresynapse.net,1433) / DB (dwpool) / UserName (UserXPTO)
Write-Error: Exception calling "Open" with "0" argument(s): "
ERROR [28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'UserXPTO'.

ERROR [01S00] [Microsoft][ODBC Driver 17 for SQL Server]Invalid connection string attribute

If we looks at first error "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'UserXPTO'." we will start believe that there is an issue with login + password.

 

And sometimes it can really be. Better double check the password. Or test to connect using different tool like Azure SQL Data Studio or SQLCMD

 

Looking into ODBC connection string it looks ok too

Driver={ODBC Driver 17 for SQL Server};Server=tcp:xxxxx.sql.azuresynapse.net,1433;Database=dwpool;UID=UserXPTO;PWD="q3@yGfAm@JHM";Connection Timeout=15;Encrypt=yes;TrustServerCertificate=no

There is no difference in the code

FonsecaSergio_0-1612909406743.png

 

There is also this sample from a customer case I worked recently where cx was also getting some connection error. But error message was little bit different. But It looks like just permission problem or (user + password) error

FonsecaSergio_1-1612827099816.png

 

This one on my environment went fine

FonsecaSergio_2-1612910256676.png

 

 

I could not repro customer exact error probably because of version he had vs the version I was using but the error behind the scene is same for both and its explained at https://docs.microsoft.com/en-us/sql/relational-databases/security/strong-passwords

 

Passwords can be the weakest link in a server security deployment. Take great care when you select a password. A strong password has the following characteristics:
- Is at least eight characters long.
- Combines letters, numbers, and symbol characters within the password.
- Is not found in a dictionary.
- Is not the name of a command.
- Is not the name of a person.
- Is not the name of a user.
- Is not the name of a computer.
- Is changed regularly.
- Is different from previous passwords.

Microsoft SQL Server passwords can contain up to 128 characters, including letters, symbols, and digits. Because logins, user names, roles, and passwords are frequently used in Transact-SQL statements, certain symbols must be enclosed by double quotation marks (") or square brackets ([ ]). Use these delimiters in Transact-SQL statements when the SQL Server login, user, role, or password has the following characteristics:
- Contains or starts with a space character.
- Starts with the $ or @ character.

If used in an OLE DB or ODBC connection string, a login or password must not contain the following
characters: [] () , ; ? * ! @ =. These characters are used to either initialize a connection or
separate connection values.

 

You can use some workarounds / solutions below

  • If you cannot change application code and getting this error, just DO NOT use these special char documented above.

 

 

  • If you can: try to change how you set the password. On my tests I was able to work around the issue by not using quotes in the password (xxx vs "xxxvs 'xxx'), but it will probably depend on the char used
    • $connectionString += "PWD=""$Password"";" - FAILS
    • $connectionString += "PWD='$Password';" - FAILS
    • $connectionString += "PWD=$Password;" - OK

Quotes are supported, but for some reason help to prevent the error https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms722656(v=vs.85)#setting-values-...

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2118544%22%20slang%3D%22en-US%22%3ESynapse%20%2F%20SQL%20Password%20so%20secure%20that%20even%20you%20cannot%20use%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2118544%22%20slang%3D%22en-US%22%3E%3CP%3EEveryone%20knows%20that%20the%20your%20password%20should%20be%20very%20strong%2C%20and%20there%20companies%20that%20use%20password%20generator%20to%20create%20complex%20password%20and%20this%20is%20fine%20too.%20But%20sometimes%20or%20better%20saying%20in%20some%20conditions%20this%20can%20cause%20some%20connectivity%20issues%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELets%20start%20using%20a%20free%20password%20generator%20I%20found%20on%20internet%20where%20I%20got%20something%20that%20looks%20like%20a%20good%20password%20%22q3%40yGfAm%40JHM%22.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22FonsecaSergio_0-1612824941391.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F253483i439E59E96810061A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22FonsecaSergio_0-1612824941391.png%22%20alt%3D%22FonsecaSergio_0-1612824941391.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%20me%20create%20a%20login%20%2B%20user%20using%20it%20TSQL%20below%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E--MASTER%20DB%0ACREATE%20LOGIN%20UserXPTO%20WITH%20PASSWORD%20%3D%20'q3%40yGfAm%40JHM'%0A%0A--USER%20DB%0ACREATE%20USER%20UserXPTO%20FOR%20LOGIN%20UserXPTO%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20let%20me%20try%20to%20connect%20to%20is%20using%20%3CSTRONG%3E.NET%20SQLClient%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EClear-Host%0A%0AWrite-Host%20%22NATIVE%20CLIENT%20TEST%22%20-ForegroundColor%20Green%0A%0A%24Server%20%3D%20%22tcp%3Axxxxx.sql.azuresynapse.net%2C1433%22%0A%24Database%20%3D%20%22dwpool%22%0A%24Username%20%3D%20%22UserXPTO%22%0A%24Password%20%3D%20%22q3%40yGfAm%40JHM%22%0A%24SQLText%20%3D%20%22Select%20getdate()%20as%20NOW%22%0A%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%24connectionTimeout%20%3D%2015%0A%0A%24connectionString%20%3D%20%22Server%3D%24Server%3B%22%0A%24connectionString%20%2B%3D%20%22Initial%20Catalog%3D%24Database%3B%22%0A%24connectionString%20%2B%3D%20%22User%20ID%3D%24Username%3B%22%0A%24connectionString%20%2B%3D%20%22Password%3D%22%22%24Password%22%22%3B%22%0A%24connectionString%20%2B%3D%20%22Connection%20Timeout%3D%24(%24connectionTimeout)%3B%22%0A%24connectionString%20%2B%3D%20%22Persist%20Security%20Info%3DFalse%3BMultipleActiveResultSets%3DFalse%3BEncrypt%3DTrue%3BTrustServerCertificate%3DFalse%22%0A%0A%24connection%20%3D%20New-Object%20-TypeName%20System.Data.SqlClient.SqlConnection(%24connectionString)%0A%0AWrite-Host%20%22CurrentTime%3A%20%24(((Get-Date).ToUniversalTime()).ToString(%22yyyy-MM-dd%20HH%3Amm%3Ass%22))%20UTC%22%0AWrite-Host%20%22Connection%20to%20Server%20(%24(%24Server))%20%2F%20DB%20(%24(%24Database))%20%2F%20UserName%20(%24(%24Username))%22%0A%0ATry%20%7B%0A%20%20%20%20%24connection.open()%0A%20%20%20%20Write-Host%20%22Connection%20with%20success%22%0A%0A%20%20%20%20%24command%20%3D%20New-Object%20-TypeName%20System.Data.SqlClient.SqlCommand%0A%20%20%20%20%24command.CommandTimeout%20%3D%2060%0A%20%20%20%20%24command.connection%20%3D%20%24connection%0A%20%20%20%20%24command.CommandText%20%3D%20%24SQLText%0A%0A%20%20%20%20%24result%20%3D%20%24command.ExecuteScalar()%20%20%20%20%0A%20%20%20%20Write-Host%20%22Query%20success.%20Server%20currenttime%20(%24(%24result))%22%0A%20%20%20%20%24connection.Close()%0A%7D%0ACatch%20%7B%0A%20%20%20%20Write-Error%20%24_.Exception.Message%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EResults%20looks%20fine%3C%2FP%3E%0A%3CPRE%3ENATIVE%20CLIENT%20TEST%3CBR%20%2F%3ECurrentTime%3A%202021-02-08%2023%3A25%3A29%20UTC%3CBR%20%2F%3EConnection%20to%20Server%20(tcp%3Axxxxx.sql.azuresynapse.net%2C1433)%20%2F%20DB%20(dwpool)%20%2F%20UserName%20(UserXPTO)%20%3CBR%20%2F%3EConnection%20with%20success%3CBR%20%2F%3EQuery%20success.%20Server%20currenttime%20(02%2F08%2F2021%2023%3A25%3A29)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20let's%20move%20to%20%3CSTRONG%3EODBC%20(Current%20installed%20version%2017.6.1.1)%3C%2FSTRONG%3E%20using%20basically%20same%20code%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EClear-Host%0A%0AWrite-Host%20%22ODBC%20CLIENT%20TEST%22%20-ForegroundColor%20Green%0A%0A%24Server%20%3D%20%22tcp%3Axxxxx.sql.azuresynapse.net%2C1433%22%0A%24Database%20%3D%20%22dwpool%22%0A%24Username%20%3D%20%22UserXPTO%22%0A%24Password%20%3D%20%22q3%40yGfAm%40JHM%22%0A%24SQLText%20%3D%20%22Select%20getdate()%20as%20NOW%22%0A%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%24connectionTimeout%20%3D%2015%0A%0A%24connectionString%20%3D%20%22Driver%3D%7BODBC%20Driver%2017%20for%20SQL%20Server%7D%3B%22%0A%24connectionString%20%2B%3D%20%22Server%3D%24Server%3B%22%0A%24connectionString%20%2B%3D%20%22Database%3D%24Database%3B%22%0A%24connectionString%20%2B%3D%20%22UID%3D%24Username%3B%22%0A%24connectionString%20%2B%3D%20%22PWD%3D%22%22%24Password%22%22%3B%22%0A%24connectionString%20%2B%3D%20%22Connection%20Timeout%3D%24(%24connectionTimeout)%3B%22%0A%24connectionString%20%2B%3D%20%22Encrypt%3Dyes%3BTrustServerCertificate%3Dno%22%0A%0A%24connection%20%3D%20New-Object%20-TypeName%20System.Data.Odbc.OdbcConnection(%24connectionString)%0A%0AWrite-Host%20%22CurrentTime%3A%20%24(((Get-Date).ToUniversalTime()).ToString(%22yyyy-MM-dd%20HH%3Amm%3Ass%22))%20UTC%22%0AWrite-Host%20%22Connection%20to%20Server%20(%24(%24Server))%20%2F%20DB%20(%24(%24Database))%20%2F%20UserName%20(%24(%24Username))%22%0A%0ATry%20%7B%0A%20%20%20%20%24connection.open()%0A%20%20%20%20Write-Host%20%22Connection%20with%20success%22%0A%0A%20%20%20%20%24command%20%3D%20New-Object%20System.Data.Odbc.OdbcCommand%0A%20%20%20%20%24command.CommandTimeout%20%3D%2060%0A%20%20%20%20%24command.connection%20%3D%20%24connection%0A%20%20%20%20%24command.CommandText%20%3D%20%24SQLText%0A%0A%20%20%20%20%24result%20%3D%20%24command.ExecuteScalar()%20%20%20%20%0A%20%20%20%20Write-Host%20%22Query%20success.%20Server%20currenttime%20(%24(%24result))%22%0A%20%20%20%20%24connection.Close()%0A%7D%0ACatch%20%7B%0A%20%20%20%20Write-Error%20%24_.Exception.Message%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20now%20the%20results%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EODBC%20CLIENT%20TEST%3CBR%20%2F%3ECurrentTime%3A%202021-02-08%2023%3A26%3A13%20UTC%3CBR%20%2F%3EConnection%20to%20Server%20(tcp%3Axxxxx.sql.azuresynapse.net%2C1433)%20%2F%20DB%20(dwpool)%20%2F%20UserName%20(UserXPTO)%20%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EWrite-Error%3A%20Exception%20calling%20%22Open%22%20with%20%220%22%20argument(s)%3A%20%22%3CBR%20%2F%3EERROR%20%5B28000%5D%20%5BMicrosoft%5D%5BODBC%20Driver%2017%20for%20SQL%20Server%5D%5BSQL%20Server%5DLogin%20failed%20for%20user%20'UserXPTO'.%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EERROR%20%5B01S00%5D%20%5BMicrosoft%5D%5BODBC%20Driver%2017%20for%20SQL%20Server%5DInvalid%20connection%20string%20attribute%3C%2FFONT%3E%3C%2FPRE%3E%0A%3CP%3EIf%20we%20looks%20at%20first%20error%26nbsp%3B%22%3CFONT%20color%3D%22%23FF0000%22%3E%3CFONT%20size%3D%222%22%3E%5BMicrosoft%5D%5BODBC%20Driver%2017%20for%20SQL%20Server%5D%5BSQL%20Server%5DLogin%20failed%20for%20user%20'UserXPTO'%3C%2FFONT%3E.%3C%2FFONT%3E%22%26nbsp%3Bwe%20will%20start%20believe%20that%20there%20is%20an%20issue%20with%20login%20%2B%20password.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20sometimes%20it%20can%20really%20be.%20Better%20%3CSTRONG%3Edouble%20check%20the%20password%3C%2FSTRONG%3E.%20Or%20test%20to%20connect%20using%20%3CSTRONG%3Edifferent%20tool%3C%2FSTRONG%3E%20like%20Azure%20SQL%20Data%20Studio%20or%20SQLCMD%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELooking%20into%20ODBC%20connection%20string%20it%20looks%20ok%20too%3C%2FP%3E%0A%3CPRE%3EDriver%3D%7BODBC%20Driver%2017%20for%20SQL%20Server%7D%3BServer%3Dtcp%3Axxxxx.sql.azuresynapse.net%2C1433%3BDatabase%3Ddwpool%3BUID%3DUserXPTO%3BPWD%3D%22q3%40yGfAm%40JHM%22%3BConnection%20Timeout%3D15%3BEncrypt%3Dyes%3BTrustServerCertificate%3Dno%3C%2FPRE%3E%0A%3CP%3EThere%20is%20no%20difference%20in%20the%20code%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22FonsecaSergio_0-1612909406743.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F253733i56D5944972D13732%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22FonsecaSergio_0-1612909406743.png%22%20alt%3D%22FonsecaSergio_0-1612909406743.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20is%20also%20this%20sample%20from%20a%20customer%20case%20I%26nbsp%3Bworked%20recently%20where%20cx%20was%20also%20getting%20some%20connection%20error.%20But%20error%20message%20was%20little%20bit%20different.%20But%20%3CSTRONG%3EIt%20looks%20like%20just%20permission%20problem%20or%20(user%20%2B%20password)%20error%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22FonsecaSergio_1-1612827099816.png%22%20style%3D%22width%3A%20617px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F253498iD8B8DAD974F84300%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22FonsecaSergio_1-1612827099816.png%22%20alt%3D%22FonsecaSergio_1-1612827099816.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20one%20on%20my%20environment%20went%20fine%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22FonsecaSergio_2-1612910256676.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F253738i373846969ABBAB85%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22FonsecaSergio_2-1612910256676.png%22%20alt%3D%22FonsecaSergio_2-1612910256676.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20could%20not%20repro%20customer%20exact%20error%20probably%20because%20of%20version%20he%20had%20vs%20the%20version%20I%20was%20using%20but%20the%20error%20behind%20the%20scene%20is%20same%20for%20both%20and%20its%20explained%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fsecurity%2Fstrong-passwords%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fsecurity%2Fstrong-passwords%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CEM%3EPasswords%20can%20be%20the%20weakest%20link%20in%20a%20server%20security%20deployment.%20Take%20great%20care%20when%20you%20select%20a%20password.%20A%20strong%20password%20has%20the%20following%20characteristics%3A%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20at%20least%20eight%20characters%20long.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Combines%20letters%2C%20numbers%2C%20and%20symbol%20characters%20within%20the%20password.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20not%20found%20in%20a%20dictionary.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20not%20the%20name%20of%20a%20command.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20not%20the%20name%20of%20a%20person.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20not%20the%20name%20of%20a%20user.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20not%20the%20name%20of%20a%20computer.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20changed%20regularly.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Is%20different%20from%20previous%20passwords.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FEM%3E%3CEM%3EMicrosoft%20SQL%20Server%20passwords%20can%20contain%20up%20to%20128%20characters%2C%20including%20letters%2C%20symbols%2C%20and%20digits.%20Because%20logins%2C%20user%20names%2C%20roles%2C%20and%20passwords%20are%20frequently%20used%20in%20Transact-SQL%20statements%2C%20certain%20symbols%20must%20be%20enclosed%20by%20double%20quotation%20marks%20(%22)%20or%20square%20brackets%20(%5B%20%5D).%20Use%20these%20delimiters%20in%20Transact-SQL%20statements%20when%20the%20SQL%20Server%20login%2C%20user%2C%20role%2C%20or%20password%20has%20the%20following%20characteristics%3A%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Contains%20or%20starts%20with%20a%20space%20character.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E-%20Starts%20with%20the%20%24%20or%20%40%20character.%3CBR%20%2F%3E%3C%2FEM%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CEM%3EIf%20used%20in%20an%20OLE%20DB%20or%20ODBC%20connection%20string%2C%20a%20login%20or%20password%20must%20not%20contain%20the%20following%20%3CBR%20%2F%3Echaracters%3A%20%5B%5D%20()%20%2C%20%3B%20%3F%20*%20!%20%40%20%3D.%20These%20characters%20are%20used%20to%20either%20initialize%20a%20connection%20or%20%3CBR%20%2F%3Eseparate%20connection%20values.%3C%2FEM%3E%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20use%20some%20workarounds%20%2F%20solutions%20below%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIf%20you%20cannot%20change%20application%20code%20and%20getting%20this%20error%2C%20just%20%3CSTRONG%3EDO%20NOT%3C%2FSTRONG%3E%20use%20these%20special%20char%20documented%20above.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETry%20to%20use%20%3CSTRONG%3Enewer%20drivers%20versions%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3E%3CFONT%20size%3D%222%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fconnect%2Fodbc%2Fdownload-odbc-driver-for-sql-server%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fconnect%2Fodbc%2Fdownload-odbc-driver-for-sql-server%3C%2FA%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fconnect%2Foledb%2Foledb-driver-for-sql-server%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CFONT%20size%3D%222%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fconnect%2Foledb%2Foledb-driver-for-sql-server%3C%2FFONT%3E%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIf%20you%20can%20try%20to%20change%20how%20you%20set%20the%20password.%20On%20my%20tests%20I%20was%20able%20to%20workaround%20issue%20%3CSTRONG%3Enot%20using%20quotes%3C%2FSTRONG%3E%20in%20the%20password%20(xxx%20vs%26nbsp%3B%3CSTRONG%3E%22%3C%2FSTRONG%3Exxx%3CSTRONG%3E%22%26nbsp%3B%3C%2FSTRONG%3Evs%20'xxx')%2C%20%3CSTRONG%3Ebut%20it%20will%20probably%20depend%20on%20the%20char%20used%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3E%3CDIV%3E%3CSPAN%3E%24connectionString%26nbsp%3B%2B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22PWD%3D%22%22%24Password%22%22%3B%22%20-%20%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3EFAILS%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3E%24connectionString%26nbsp%3B%2B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22PWD%3D'%24Password'%3B%22%20-%20%3CSTRONG%3E%3CFONT%20color%3D%22%23FF0000%22%3EFAILS%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%24connectionString%26nbsp%3B%2B%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%22PWD%3D%24Password%3B%22%20-%20%3CSTRONG%3E%3CFONT%20color%3D%22%23339966%22%3EOK%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EQuotes%20are%20supported%2C%20but%20for%20some%20reason%20workaround%20the%20error%26nbsp%3B%3CFONT%20size%3D%222%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fprevious-versions%2Fwindows%2Fdesktop%2Fms722656(v%3Dvs.85)%23setting-values-that-use-reserved-characters%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fprevious-versions%2Fwindows%2Fdesktop%2Fms722656(v%3Dvs.85)%23setting-values-that-use-reserved-characters%3C%2FA%3E%3C%2FFONT%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2118544%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESynapse%20Security%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Sep 15 2021 12:06 PM
Updated by: