Skip to content

Commit a18162d

Browse files
author
Damian Kowalczyk
committed
fix: Use ManagedIdentityCredential(clientId) constructor
ManagedIdentityCredentialOptions does not have a ClientId field. Use the constructor overload that accepts clientId as a string parameter instead. Also consolidate identity includes to the top-level azure/identity.hpp header and remove WIP comment.
1 parent 9631b7a commit a18162d

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

  • src/filesystem/implementations

src/filesystem/implementations/as.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@
2525
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
#pragma once
2727

28-
#include <azure/identity/default_azure_credential.hpp>
29-
#include <azure/identity/managed_identity_credential.hpp>
28+
#include <azure/identity.hpp>
3029
#include <azure/storage/blobs.hpp>
3130
#include <azure/storage/common/storage_credential.hpp>
3231

3332
#include "common.h"
34-
// [WIP] below needed?
3533
#undef LOG_INFO
3634
#undef LOG_WARNING
3735

@@ -184,14 +182,13 @@ ASFileSystem::ASFileSystem(const std::string& path, const ASCredential& as_cred)
184182
// Token caching and refresh are handled by the Azure Identity SDK.
185183
LOG_VERBOSE(1) << "Using Azure Managed Identity authentication for "
186184
<< account_name;
187-
std::shared_ptr<Azure::Core::Credentials::TokenCredential> token_cred;
185+
std::shared_ptr<Azure::Identity::ManagedIdentityCredential> token_cred;
188186
if (!as_cred.client_id_.empty()) {
189-
// User-assigned Managed Identity: specify the client ID.
190-
Azure::Identity::ManagedIdentityCredentialOptions mi_opts;
191-
mi_opts.ClientId = as_cred.client_id_;
187+
// User-assigned Managed Identity: pass the client ID directly
188+
// to the credential constructor.
192189
token_cred =
193190
std::make_shared<Azure::Identity::ManagedIdentityCredential>(
194-
mi_opts);
191+
as_cred.client_id_);
195192
LOG_VERBOSE(1) << "Using user-assigned Managed Identity with client ID "
196193
<< as_cred.client_id_;
197194
} else {

0 commit comments

Comments
 (0)