Connecting to SQL Server with current user

577 Views Asked by At

I need to build an service that connects to a SQL Server. My idea for authentication was to use the executing user, so I don't have to work manually with changing passwords. To connect to the SQL Server I use the System.Data.SQLClient, until now I set up a SQLConnectionStringBuilder and hardcode the credentials.

I tried to use the given NetworkCredentials from the user but could not find a way to use it for the SQL Connection.

Is there any way this could work? If not, how can I securely save the user credentials (e.g. in a file?) to read when running? The application shall run as a headless service every night so I can't use userinput while running.

Thanks in advance

0

There are 0 best solutions below