-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AAD Authentication using AccessToken #546
Conversation
Access token tests can be run by first setting SQLSERVER_DSN="sqlserver://server.database.windows.net?database=testdb&accesstoken=$at" where $at is an access token for https://database.windows.net/ for an SPN/APP that has db_owner role on testdb.
Codecov Report
@@ Coverage Diff @@
## master #546 +/- ##
=========================================
- Coverage 68.9% 68.71% -0.2%
=========================================
Files 22 23 +1
Lines 5068 5187 +119
=========================================
+ Hits 3492 3564 +72
- Misses 1370 1410 +40
- Partials 206 213 +7
Continue to review full report at Codecov.
|
…ing SSPI when using accesstoken
I'll try to raise code coverage a bit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good. I only have nits.
The only real change I really want is to put a go.mod file in the example folder or at a min in the example/azure-managed-identity folder, so the mssql module doesn't depend on adal.
I added a go.mod in the specific example folder and fixed most of the nits. The go.mod in the example need to be removed to make the example work until this gets merged, but hopefully that's only going to be temporary. |
mssql: add Azure Active Directory token based login Create a new connector that allows refreshing the access token based on an external identifier.
Although it leaves room for improvement with respect to convenience from the DSN, this PR implements AAD authentication through access tokens.
To test this implementation, create a SQL Azure database and set yourself as the AAD admin for the database. Then run
To use a service principal, grant the service principal access to the database as described in the docs.
At least partially fixes #446