Claus Ibsen created CAMEL-27749:
-----------------------------------

             Summary: camel-azure-eventgrid, camel-azure-servicebus, 
camel-azure-eventhubs: a DefaultAzureCredential set as tokenCredential is not 
used
                 Key: CAMEL-27749
                 URL: https://issues.apache.org/jira/browse/CAMEL-27749
             Project: Camel
          Issue Type: Bug
          Components: camel-azure-servicebus, camel-azure, camel-azure-eventhubs
            Reporter: Claus Ibsen
             Fix For: 4.24.0


When the {{tokenCredential}} option is a {{DefaultAzureCredential}}, the 
components set {{credentialType}} to {{AZURE_IDENTITY}} 
({{EventGridComponent.createEndpoint()}}, {{ServiceBusComponent}}, 
{{EventHubsComponent}}). For {{AZURE_IDENTITY}}, the clients are then built 
with a new {{new DefaultAzureCredentialBuilder().build()}} 
({{EventGridProducer.createEventGridPublisherClient()}}, 
{{ServiceBusClientFactory}}, {{EventHubsClientFactory}}). So a credential that 
the user built with {{.managedIdentityClientId(...)}}, {{.tenantId(...)}} or 
other settings is not used.

In camel-azure-eventgrid this also happens with an explicit 
{{credentialType=TOKEN_CREDENTIAL}}, as the component replaces it with 
{{AZURE_IDENTITY}} for a {{DefaultAzureCredential}}.

Fix: with {{AZURE_IDENTITY}}, use the {{tokenCredential}} instance when it is 
set, and build a new DefaultAzureCredential only when it is not. In eventgrid, 
keep an explicit {{TOKEN_CREDENTIAL}} or {{AZURE_IDENTITY}}.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to