r/SQLServer • u/man__i__love__frogs • Oct 24 '25
Question App requires ado.net connection string with password in plain text
Hello, in a bit of a pickle. I'm a Systems Engineer, not all that much SQL experience. My company is in financial services and we migrated to a new core app earlier this year. All said and done it turns out this new app didn't do some accounting/reconciliation things as well as our old one.
There's a company that pretty much specializes in this niche and has a product that does everything we need. However it's such a niche that their app is archaic and they don't seem to have any desire to improve it, nor do they have any competition.
The app requires a direct DB connection, and either does windows auth, or SQL auth. Another wrench is that our strategy is to go Entra only and we're decommissioning our on-prem AD and servers. Our compromise for this project was that we'd use AzureSQL and Azure Virtual Desktop on entra only. We don't have the on prem infrastructure or another use for AD based RDS, and direct db connections, especially with a plain text connection string can't be on user workstations/thick clients.
So far everything is working great. The only hiccup has been that the app uses an app.exe.config for the connection string, and the method is System.Data.SqlClient.dll - my understanding is that for EntraID to work the app would have to use Microsoft.Data.SqlClient.dll the vendor said supporting Entra auth is out of the question for them, but I'm wondering if there might be a simple work around, or some other way this can be mitigated, like use environment variables, or SSL cert based auth or something along those lines.
•
u/AutoModerator Oct 24 '25
After your question has been solved /u/man__i__love__frogs, please reply to the helpful user's comment with the phrase "Solution verified".
This will not only award a point to the contributor for their assistance but also update the post's flair to "Solved".
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
6
u/jshine13371 6 Oct 25 '25
Why don't you want to use SQL Auth?...don't get me wrong, their app sounds dumbly insecure, but that would probably be the simplest solution here. Create a single SQL Login that is used for this.
You're not going to be able to switch out the dependent library without the app's source code and rebuilding the project yourself. 0% chance.
4
u/xxxxxxxxxxxxxxxxx99 Oct 25 '25
Others have already correctly pointed out your only option is to use SQL Auth and therefore the plain text password.
Depending on how the connection string is being handled in the config file, do you have the option to have it refer to an ODBC DSN instead of a server? That might give you some other options.
Re: the plaintext password, some mitigations you might want to consider (all of these require some work, or even a lot of work - depends on your risk appetite):
7
u/dbrownems Microsoft Employee Oct 25 '25 edited Oct 25 '25
Yes, without app changes you are stuck with SQL Auth, which requires storing a password.
So that's the TLDR, but there's a bit more detail around the edges. The key limitation here is that the app uses System.Data.SqlClient, which is the legacy ADO.NET provider. The modern Microsoft.Data.SqlClient has more Entra ID authentication options.
System.Data.SqlClients supports only three Entra auth modes:
When using Microsoft.Data.SqlClient there are more options, like ActiveDirectoryServicePrincipal which uses a client id and client secret to connect. Or you can connect with a managed identity, or with credentials stored in environment variables.
5
u/nilanganray Oct 28 '25
The core issue is that System.Data.SqlClient simply can’t do modern Entra ID auth. That functionality only exists in Microsoft.Data.SqlClient and since the vendor won’t migrate, you’re boxed into SQL Auth. You can still mitigate the plain text password risk though. Options like DPAPI or pulling the credentials from Azure Key Vault at runtime can work if you control the environment. You can use a lightweight proxy or drop-in ADO.NET provider that supports Azure AD auth (dotConnect for SQL Server maybe) to keep compatibility while avoiding hardcoded credentials. It’s not a full fix without vendor changes but it can reduce the exposure and buy time.