Skip to content

Commit 816c29f

Browse files
committed
ADLS: Support Vended Credentials
First version with `Fsspec`. Will check with PyArrow tomorrow, but that one seems to be lacking the SAS token: https://arrow.apache.org/docs/cpp/api/filesystem.html#azure-filesystem Closes apache#1146
1 parent b806cfa commit 816c29f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pyiceberg/io/fsspec.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@ def _gs(properties: Properties) -> AbstractFileSystem:
179179
def _adls(properties: Properties) -> AbstractFileSystem:
180180
from adlfs import AzureBlobFileSystem
181181

182+
adls_sas_tokens = {
183+
key.replace(f"{ADLS_SAS_TOKEN}.", ""): value for key, value in properties.items() if key.startswith(ADLS_SAS_TOKEN)
184+
}
185+
186+
for key, sas_token in adls_sas_tokens.items():
187+
if key.endswith(".windows.net"):
188+
if ADLS_ACCOUNT_NAME not in properties:
189+
properties[ADLS_ACCOUNT_NAME] = key.split(".")[0]
190+
if ADLS_SAS_TOKEN not in properties:
191+
properties[ADLS_SAS_TOKEN] = sas_token
192+
182193
return AzureBlobFileSystem(
183194
connection_string=properties.get(ADLS_CONNECTION_STRING),
184195
account_name=properties.get(ADLS_ACCOUNT_NAME),

0 commit comments

Comments
 (0)