-1

Hi I'm new to this and want to know if i can create a connection without passing password in connection string.

I can't use windows authentication because most of users don't have access to database.

$ConnectionString="Data Source=$SqlServer;Initial Catalog=$Database; Integrated Security=True;"

So have to go with SQL Authentication

$connString = "Data Source=$SqlServer;Database=$Database;User ID=$SqlAuthLogin;Password=$SqlAuthPw"

But not to pass password in connection string . Is it possible by any way. If not then also let me know.

Any help will be thankfull.

  • 1
    The design looks like a flawed one. If you don't want (why indeed?) give users access to the DB, use a middleware server instead. The proposed solution, using a shared account, removes a crucial part of your audit chain. Or something else, what, depends what you are really trying to achieve. – vonPryz Nov 11 '22 at 12:57
  • You keep on asking this same question over and over. I suggest you stick with one question and respond to comments and requests for clarification until you solve it. Don't just ask the same questions over and over – Nick.Mc Nov 11 '22 at 14:31
  • 1
    I’m voting to close this question because it's already been asked and left dead here https://stackoverflow.com/questions/74011697/how-can-i-connect-to-sql-without-passing-credentials-in-connection-string-using?noredirect=1#comment131342728_74011697 – Nick.Mc Nov 11 '22 at 14:31

1 Answers1

1

SQL does not allow anonymous access. You can create a SQL user with only read permissions to information that you want. The only risk there is that a user could change the password but for a small internal project the risk would probably be acceptable.

Jason Geiger
  • 1,912
  • 18
  • 32