Skip to content

Commit a7e734a

Browse files
committed
Add token auth option for azure adx service
1 parent 4a7cd60 commit a7e734a

File tree

1 file changed

+9
-0
lines changed
  • airflow/providers/microsoft/azure/hooks

1 file changed

+9
-0
lines changed

airflow/providers/microsoft/azure/hooks/adx.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import warnings
2929
from typing import Any
3030

31+
from azure.identity import DefaultAzureCredential
3132
from azure.kusto.data import ClientRequestProperties, KustoClient, KustoConnectionStringBuilder
3233
from azure.kusto.data.exceptions import KustoServiceError
3334
from azure.kusto.data.response import KustoResponseDataSetV2
@@ -183,6 +184,14 @@ def get_required_param(name: str) -> str:
183184
)
184185
elif auth_method == "AAD_DEVICE":
185186
kcsb = KustoConnectionStringBuilder.with_aad_device_authentication(cluster)
187+
elif auth_method == "AZURE_TOKEN_CRED":
188+
credential = conn.password
189+
if not credential:
190+
credential = DefaultAzureCredential()
191+
kcsb = KustoConnectionStringBuilder.with_azure_token_credential(
192+
connection_string=cluster,
193+
credential=credential,
194+
)
186195
else:
187196
raise AirflowException(f"Unknown authentication method: {auth_method}")
188197

0 commit comments

Comments
 (0)