How to to use SQL Server application role in my connection string

1.5k Views Asked by At

My current application uses very powerful credentials to access the SQL Server back-end database. I want to improve the security in my application by using an application role created.

For example, if I created one called app-role, with a password:

EXECUTE sp_addapprole @rolename = 'app-role', @password = `right pony duracell binderclip`

I want to enable the use of this application automatically during connection by specifying it in a connection string. I don't want to risk there being any places in the software that are accidentally not re-engineered to call:

EXECUTE sp_setapprole @rolename = 'app-role', @password = `right pony duracell binderclip`, @encrypt = 'odbc'

So obviously I want this to happen automatically during connection.

Bonus Chatter

The application roles feature was first added in SQL Server 2000.

Bonus Reading

0

There are 0 best solutions below