Skip to content

Commit 73f7b5b

Browse files
committed
Also add the change to the async part
1 parent b7cd8d4 commit 73f7b5b

File tree

1 file changed

+12
-4
lines changed
  • airflow/providers/microsoft/azure/hooks

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,18 @@ async def get_async_conn(self) -> AsyncBlobServiceClient:
576576
account_url = conn.host if conn.host else f"https://{conn.login}.blob.core.windows.net/"
577577
parsed_url = urlparse(account_url)
578578

579-
if not parsed_url.netloc and "." not in parsed_url.path:
580-
# if there's no netloc and no dots in the path, then user only
581-
# provided the Active Directory ID, not the full URL or DNS name
582-
account_url = f"https://{conn.login}.blob.core.windows.net/"
579+
if not parsed_url.netloc:
580+
if "." not in parsed_url.path:
581+
# if there's no netloc and no dots in the path, then user only
582+
# provided the Active Directory ID, not the full URL or DNS name
583+
account_url = f"https://{conn.login}.blob.core.windows.net/"
584+
else:
585+
# if there's no netloc but there are dots in the path, then user
586+
# provided the DNS name without the https:// prefix.
587+
# Azure storage account name can only be 3 to 24 characters in length
588+
# https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview#storage-account-name
589+
acc_name = account_url.split(".")[0][:24]
590+
account_url = f"https://{acc_name}." + ".".join(account_url.split(".")[1:])
583591

584592
tenant = self._get_field(extra, "tenant_id")
585593
if tenant:

0 commit comments

Comments
 (0)