Skip to content

Commit 42c30a4

Browse files
committed
validate that all three are provided together
1 parent ad28d25 commit 42c30a4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pyiceberg/io/pyarrow.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,17 @@ def _initialize_azure_fs(self) -> FileSystem:
546546
if tenant_id := self.properties.get(ADLS_TENANT_ID):
547547
client_kwargs["tenant_id"] = tenant_id
548548

549+
# Validate that all three are provided together for ClientSecretCredential
550+
credential_keys = ["client_id", "client_secret", "tenant_id"]
551+
provided_keys = [key for key in credential_keys if key in client_kwargs]
552+
if provided_keys and len(provided_keys) != len(credential_keys):
553+
missing_keys = [key for key in credential_keys if key not in client_kwargs]
554+
raise ValueError(
555+
f"client_id, client_secret, and tenant_id must all be provided together "
556+
f"to use ClientSecretCredential for Azure authentication. "
557+
f"Provided: {provided_keys}, Missing: {missing_keys}"
558+
)
559+
549560
return AzureFileSystem(**client_kwargs)
550561

551562
def _initialize_hdfs_fs(self, scheme: str, netloc: Optional[str]) -> FileSystem:

0 commit comments

Comments
 (0)