ephraimbuddy commented on code in PR #33457:
URL: https://github.com/apache/airflow/pull/33457#discussion_r1296528091
##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -152,11 +153,13 @@ def get_conn(self) -> BlobServiceClient:
# connection_string auth takes priority
return BlobServiceClient.from_connection_string(connection_string,
**extra)
- account_url = (
- conn.host
- if conn.host and conn.host.startswith("https://")
- else f"https://{conn.login}.blob.core.windows.net/"
- )
+ account_url = conn.host if conn.host else
f"https://{conn.login}.blob.core.windows.net/"
+ parsed_url = urlparse(account_url)
+
+ if not parsed_url.netloc and "." not in parsed_url.path:
+ # if there's no netloc and no dots in the path, then user only
+ # provided the host ID, not the full URL or DNS name
+ account_url = f"https://{conn.login}.blob.core.windows.net/"
Review Comment:
Not the host ID, sorry, I'll update that. What I mean is the Active
Directory ID.
The host field is named Active Directory Auth so at times people use the
active directory ID there and it seems to be there even before we upgraded to
blob storage v12
We can’t create the url with the Active Directory ID. We can only create it
with the account name/login. That’s what works
##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -152,11 +153,13 @@ def get_conn(self) -> BlobServiceClient:
# connection_string auth takes priority
return BlobServiceClient.from_connection_string(connection_string,
**extra)
- account_url = (
- conn.host
- if conn.host and conn.host.startswith("https://")
- else f"https://{conn.login}.blob.core.windows.net/"
- )
+ account_url = conn.host if conn.host else
f"https://{conn.login}.blob.core.windows.net/"
+ parsed_url = urlparse(account_url)
+
+ if not parsed_url.netloc and "." not in parsed_url.path:
+ # if there's no netloc and no dots in the path, then user only
+ # provided the host ID, not the full URL or DNS name
+ account_url = f"https://{conn.login}.blob.core.windows.net/"
Review Comment:
Not the host ID, sorry, I'll update that. What I mean is the Active
Directory ID.
The host field is named Active Directory Auth so at times people use the
active directory ID there and it seems to be there even before we upgraded to
blob storage v12
We can’t create the url with the Active Directory ID. We can only create it
with the account name/login. That’s what works
--
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]