Skip to content

Commit

Permalink
Do not attempt Azure shared key authentication if no account name is …
Browse files Browse the repository at this point in the history
…specified.

We emit a warning and attempt other authentication methods.
  • Loading branch information
teo-tsirpanis committed Apr 5, 2024
1 parent 5997aff commit 20730c5
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tiledb/sm/filesystem/azure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,21 @@ Azure::AzureClientSingleton::get(const AzureParameters& params) {
// Construct the Azure SDK blob service client.
// We pass a shared key if it was specified.
if (!params.account_key_.empty()) {
client_ =
tdb_unique_ptr<::Azure::Storage::Blobs::BlobServiceClient>(tdb_new(
::Azure::Storage::Blobs::BlobServiceClient,
params.blob_endpoint_,
make_shared<::Azure::Storage::StorageSharedKeyCredential>(
HERE(), params.account_name_, params.account_key_),
options));
return *client_;
// If we don't have an account name, warn and try other authentication methods.
if (params.account_name_.empty()) {
LOG_WARN(
"Azure storage account name must be set when specifying account key. "
"Account key will be ignored.");
} else {
client_ =
tdb_unique_ptr<::Azure::Storage::Blobs::BlobServiceClient>(tdb_new(
::Azure::Storage::Blobs::BlobServiceClient,
params.blob_endpoint_,
make_shared<::Azure::Storage::StorageSharedKeyCredential>(
HERE(), params.account_name_, params.account_key_),
options));
return *client_;
}
}

// Otherwise, if we did not specify an SAS token
Expand Down

0 comments on commit 20730c5

Please sign in to comment.