Skip to content

Commit

Permalink
Add docs and support for Azure AD Auth
Browse files Browse the repository at this point in the history
In base.py, if the user would like to use interactive auth, then password is not needed.
  • Loading branch information
absci committed Mar 25, 2021
1 parent 00bbdca commit b41e8b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Welcome to the MSSQL-Django 3rd party backend project!

*mssql-django* is a fork of [django-mssql-backend](https://pypi.org/project/django-mssql-backend/). This project provides an enterprise database connectivity option for the Django Web Framework, with support for Microsoft SQL Server and Azure SQL Database.

We'd like to give thanks to the community that made this project possible, with particular recognition of the contributors: OskarPersson, michiya, dlo and the original Google Code django-pyodbc team. Moving forward we encourage partipation in this project from both old and new contributors!
We'd like to give thanks to the community that made this project possible, with particular recognition of the contributors: OskarPersson, michiya, dlo and the original Google Code django-pyodbc team. Moving forward we encourage partipation in this project from both old and new contributors!

We hope you enjoy using the MSSQL-Django 3rd party backend.

Expand Down Expand Up @@ -81,7 +81,7 @@ for any given database-level settings dictionary:

String. The name of database to use when running the test suite.
If the default value (`None`) is used, the test database will use
the name `"test\_" + NAME`.
the name `"test_" + NAME`.

- COLLATION

Expand Down Expand Up @@ -151,7 +151,7 @@ Dictionary. Current available keys are:
- extra_params

String. Additional parameters for the ODBC connection. The format is
``"param=value;param=value"``.
``"param=value;param=value"``, [Azure AD Authentication](https://github.com/microsoft/mssql-django/wiki/Azure-AD-Authentication) can be added to this field.

- collation

Expand Down
3 changes: 2 additions & 1 deletion mssql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ def get_new_connection(self, conn_params):

if user:
cstr_parts['UID'] = user
cstr_parts['PWD'] = password
if 'Authentication=ActiveDirectoryInteractive' not in options.get('extra_params', ''):
cstr_parts['PWD'] = password
else:
if ms_drivers.match(driver):
cstr_parts['Trusted_Connection'] = 'yes'
Expand Down

2 comments on commit b41e8b4

@Yunmeng1993
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use Authentication=ActiveDirectoryServicePrincipal ? Here is the link supported by Azure https://learn.microsoft.com/en-us/sql/connect/odbc/using-azure-active-directory?view=sql-server-ver16

@absci
Copy link
Contributor Author

@absci absci commented on b41e8b4 Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use Authentication=ActiveDirectoryServicePrincipal ? Here is the link supported by Azure https://learn.microsoft.com/en-us/sql/connect/odbc/using-azure-active-directory?view=sql-server-ver16

Here's the example from Wiki
https://github.com/microsoft/mssql-django/wiki/Azure-AD-Authentication#service-principal-authentication

Please sign in to comment.