Skip to content

Commit 2fe6e47

Browse files
authored
Adding AAD auth (microsoft#261)
Adding azureaccounttoken as a connection property Setting the token as the password if a token is provided. This way if AAD auth is used, AAD token replaces standard password when authenticating
1 parent 8f0fc40 commit 2fe6e47

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ossdbtoolsservice/capabilities/connection_options/mysql_connection_options.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@
5252
is_required=True,
5353
group_name='Security'
5454
),
55+
ConnectionOption(
56+
name='azureAccountToken',
57+
display_name='Access Token',
58+
description='Indicates an Active Directory access token to be used when connecting to the data source',
59+
value_type=ConnectionOption.VALUE_TYPE_ACCESS_TOKEN,
60+
special_value_type=ConnectionOption.SPECIAL_VALUE_ACCESS_TOKEN_NAME,
61+
is_identity=True,
62+
is_required=False,
63+
group_name='Security'
64+
),
5565
ConnectionOption(
5666
name='bindAddress',
5767
display_name='Host IP address',

ossdbtoolsservice/driver/types/pymysql_driver.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def __init__(self, conn_params: {}, config: Optional[Configuration] = None):
5151
:param conn_params: connection parameters dict
5252
:param config: optional Configuration object with mysql connection config
5353
"""
54+
55+
if 'azureAccountToken' in conn_params:
56+
conn_params['password'] = conn_params['azureAccountToken']
57+
5458
# Map the provided connection parameter names to pymysql param names
5559
_params = {MYSQL_CONNECTION_OPTION_KEY_MAP.get(param, param) : value for param, value in conn_params.items()}
5660

0 commit comments

Comments
 (0)