I have the following connection: cnxn = pyodbc.connect("DRIVER={SQL Server};SERVER=nameofmyserver;DATABASE=nameofmydb;TRUSTED_CONNECTION=Yes;")
The Flask app is on IIS and has Windows Authentication enabled.
On one route, I return request.environ.get('REMOTE_USER').split('\\')[1] which returns my username as expected
When I try and connect to MSSQL I get an error as follows:
[28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'DOMAIN\\7A6AUSRV02$'.
Any suggestions on how to resolve this issue?
I have tried changing the driver to no avail
What I am trying to do is list stored procedures that the current logged in user has access to
This
DOMAIN\7A6AUSRV02$
Is the computer account for the server named 7A6AUSRV02. It's a domain account, and can be granted access to SQL Server like any other Windows domain account. eg
You should have a database role that defines the database permissions needed for the flask app, and you should add this user to that role, eg