File tree 1 file changed +12
-4
lines changed
airflow/providers/microsoft/azure/hooks 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -576,10 +576,18 @@ async def get_async_conn(self) -> AsyncBlobServiceClient:
576
576
account_url = conn .host if conn .host else f"https://{ conn .login } .blob.core.windows.net/"
577
577
parsed_url = urlparse (account_url )
578
578
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 :])
583
591
584
592
tenant = self ._get_field (extra , "tenant_id" )
585
593
if tenant :
You can’t perform that action at this time.
0 commit comments