dabla opened a new issue, #77371:
URL: https://github.com/apache/airflow/issues/77371

   ### What happened and how to reproduce it?
   
   `airflow.providers.microsoft.azure.fs.adls.get_fs()` builds the filesystem 
behind `ObjectStoragePath("abfs://...")`. Unless the connection has a 
connection string, it always passes an `account_url` keyword to 
`adlfs.AzureBlobFileSystem` 
([adls.py#L50-L52](https://github.com/apache/airflow/blob/ff812b65b93ce2059378a797eaf1378c6154592f/providers/microsoft/azure/src/airflow/providers/microsoft/azure/fs/adls.py#L50-L52)):
   
   ```python
   options: dict[str, Any] = {
       "account_url": parse_blob_account_url(conn.host, conn.login),
   }
   ```
   
   `AzureBlobFileSystem.__init__` has no `account_url` parameter, so the value 
falls into `**kwargs` and is never used ([adlfs 
spec.py#L308-L321](https://github.com/fsspec/adlfs/blob/2026.5.0/adlfs/spec.py#L308-L321)).
 adlfs needs `account_name` (or `AZURE_STORAGE_ACCOUNT_NAME`) and builds the 
URL itself from `account_name` or `account_host`. Without one of those it 
raises 
([spec.py#L530-L566](https://github.com/fsspec/adlfs/blob/2026.5.0/adlfs/spec.py#L530-L566)):
   
   ```
   ValueError: Must provide either a connection_string or account_name with 
credentials!!
   ```
   
   So every connection whose account is known only through `host` or `login`, 
and not through `account_name` in Extra, fails in `ObjectStoragePath`, even 
though the same connection works with the hooks:
   
   - a `wasb` connection with a shared key: `login` is the account name, 
`password` is the key, and `host` is empty. `WasbHook` builds its URL from the 
same `parse_blob_account_url(conn.host, conn.login)` and passes it to 
`BlobServiceClient`, which reads it 
([wasb.py#L181](https://github.com/apache/airflow/blob/ff812b65b93ce2059378a797eaf1378c6154592f/providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/wasb.py#L181));
   - a `wasb` connection with a service principal and the account URL in `host` 
(`https://<account>.blob.core.windows.net`);
   - an `adls` connection with a full endpoint in `host`.
   
   Reproduction, with any storage account and key:
   
   ```python
   import os
   
   os.environ["AIRFLOW_CONN_WASB_KEY"] = (
       '{"conn_type": "wasb", "login": "<storage-account>", "password": 
"<account-key>"}'
   )
   
   from airflow.sdk import ObjectStoragePath
   
   ObjectStoragePath("abfs://wasb_key@<container>/").iterdir()
   # ValueError: Must provide either a connection_string or account_name with 
credentials!!
   ```
   
   Adding `"extra": {"account_name": "<storage-account>"}` makes it work, 
because `account_name` is one of the Extra keys `get_fs()` overlays onto the 
options.
   
   #68344 (fixes #40410) solves this for `adls` connections with a bare account 
name in `host`, which now get `account_name`. As agreed in the review there 
([review of 
2026-08-29](https://github.com/apache/airflow/pull/68344#pullrequestreview-5058530045)),
 the `account_url` path for the other connections was left out of that PR's 
scope. This issue tracks it.
   
   ### What you think should happen instead?
   
   `get_fs()` should give adlfs the parameters it actually reads. When the 
account comes from `host` or `login`, derive them from the URL that 
`parse_blob_account_url()` already computes: `account_name` from the first 
label of its host and `account_host` from its netloc. Keep the Extra overlay so 
an explicit `account_name` or `account_host` still wins, and stop passing 
`account_url`. A test should use the real `AzureBlobFileSystem` constructor, or 
at least check its signature, so a keyword adlfs drops can't pass unnoticed 
again. The current tests mock the class and so accept any keyword.
   
   ### Anything else?
   
   The ADLS filesystem docs added in #68344 (`docs/filesystems/adls.rst`) tell 
users to put the bare account name in Host and use `account_host` in Extra for 
custom domains. Once this is fixed, a `wasb` section could follow the same 
pattern.
   


-- 
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