Adaverse commented on code in PR #32082:
URL: https://github.com/apache/airflow/pull/32082#discussion_r1261368412


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -200,22 +190,33 @@ def get_conn(self) -> BlobServiceClient:
             token_credential = ClientSecretCredential(tenant, app_id, 
app_secret, **client_secret_auth_config)
             return BlobServiceClient(account_url=conn.host, 
credential=token_credential, **extra)
 
+        account_url = conn.host if conn.host else 
f"https://{conn.login}.blob.core.windows.net/";
+
+        if self.public_read:
+            # Here we use anonymous public read
+            # more info
+            # 
https://docs.microsoft.com/en-us/azure/storage/blobs/storage-manage-access-to-resources
+            return BlobServiceClient(account_url=account_url, **extra)
+
+        shared_access_key = self._get_field(extra, "shared_access_key")
+        if shared_access_key:
+            # using shared access key
+            return BlobServiceClient(account_url=account_url, 
credential=shared_access_key, **extra)
+
         sas_token = self._get_field(extra, "sas_token")
         if sas_token:
             if sas_token.startswith("https"):
                 return BlobServiceClient(account_url=sas_token, **extra)
             else:
-                return BlobServiceClient(
-                    
account_url=f"https://{conn.login}.blob.core.windows.net/{sas_token}";, **extra
-                )
+                return 
BlobServiceClient(account_url=f"{account_url}/{sas_token}", **extra)

Review Comment:
   Yes correct will patch it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to