You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2023/03/10 12:11:38 UTC

[airflow] branch main updated: Fix AzureDataLakeStorageV2Hook `account_url` with Active Directory authentication (#29980) (#29981)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 008f52444a Fix AzureDataLakeStorageV2Hook `account_url` with Active Directory authentication (#29980) (#29981)
008f52444a is described below

commit 008f52444a84ceaa2de7c2166b8f253f55ca8c21
Author: Adam Whitney <94...@users.noreply.github.com>
AuthorDate: Fri Mar 10 12:11:28 2023 +0000

    Fix AzureDataLakeStorageV2Hook `account_url` with Active Directory authentication (#29980) (#29981)
---
 .../providers/microsoft/azure/hooks/data_lake.py   | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/airflow/providers/microsoft/azure/hooks/data_lake.py b/airflow/providers/microsoft/azure/hooks/data_lake.py
index ad5e9818a9..d143452b00 100644
--- a/airflow/providers/microsoft/azure/hooks/data_lake.py
+++ b/airflow/providers/microsoft/azure/hooks/data_lake.py
@@ -271,10 +271,10 @@ class AzureDataLakeStorageV2Hook(BaseHook):
 
         return {
             "connection_string": PasswordField(
-                lazy_gettext("ADLS gen2 Connection String (optional)"), widget=BS3PasswordFieldWidget()
+                lazy_gettext("ADLS Gen2 Connection String (optional)"), widget=BS3PasswordFieldWidget()
             ),
             "tenant_id": StringField(
-                lazy_gettext("Tenant Id (Active Directory Auth)"), widget=BS3TextFieldWidget()
+                lazy_gettext("Tenant ID (Active Directory)"), widget=BS3TextFieldWidget()
             ),
         }
 
@@ -284,17 +284,17 @@ class AzureDataLakeStorageV2Hook(BaseHook):
         return {
             "hidden_fields": ["schema", "port"],
             "relabeling": {
-                "login": "ADLS gen2 Storage Login (optional)",
-                "password": "ADLS gen2 Storage Key (optional)",
-                "host": "Account Name (Active Directory Auth)",
+                "login": "Client ID (Active Directory)",
+                "password": "ADLS Gen2 Key / Client Secret (Active Directory)",
+                "host": "ADLS Gen2 Account Name",
             },
             "placeholders": {
                 "extra": "additional options for use with FileService and AzureFileVolume",
-                "login": "account name",
-                "password": "secret",
-                "host": "account url",
-                "connection_string": "connection string auth",
-                "tenant_id": "tenant",
+                "login": "client id",
+                "password": "key / secret",
+                "host": "storage account name",
+                "connection_string": "connection string (overrides auth)",
+                "tenant_id": "tenant id",
             },
         }
 
@@ -321,13 +321,13 @@ class AzureDataLakeStorageV2Hook(BaseHook):
             app_secret = conn.password
             token_credential = ClientSecretCredential(tenant, app_id, app_secret)
             return DataLakeServiceClient(
-                account_url=f"https://{conn.login}.dfs.core.windows.net", credential=token_credential, **extra
+                account_url=f"https://{conn.host}.dfs.core.windows.net", credential=token_credential, **extra
             )
+
+        # otherwise, use key auth
         credential = conn.password
         return DataLakeServiceClient(
-            account_url=f"https://{conn.login}.dfs.core.windows.net",
-            credential=credential,
-            **extra,
+            account_url=f"https://{conn.host}.dfs.core.windows.net", credential=credential, **extra
         )
 
     def _get_field(self, extra_dict, field_name):