This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.18.x by this push:
     new a06e3741c1f3 [backport camel-4.18.x] CAMEL-27749: 
camel-azure-eventgrid, camel-azure-servicebus, camel-azure-eventhubs - a 
DefaultAzureCredential set as tokenCredential is not used (#31056)
a06e3741c1f3 is described below

commit a06e3741c1f364724abc583cde54ffe5aa664512
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Nov 28 08:14:06 2026 +0100

    [backport camel-4.18.x] CAMEL-27749: camel-azure-eventgrid, 
camel-azure-servicebus, camel-azure-eventhubs - a DefaultAzureCredential set as 
tokenCredential is not used (#31056)
    
    Backport of #31053 to camel-4.18.x: a DefaultAzureCredential set as 
tokenCredential is now used by the AZURE_IDENTITY credential type of 
camel-azure-eventgrid, camel-azure-servicebus and camel-azure-eventhubs, 
instead of a new DefaultAzureCredential.
    
    Ported to 4.18.x: each component uses its own CredentialType (no 
camel-azure-common), the tests use camel-test-junit5, tokenCredential keeps 
secret = true, eventgrid has no catalog JSON or DSL classes on this branch, and 
the eventhubs and servicebus generated files are regenerated.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../camel/catalog/components/azure-eventhubs.json  |  8 +-
 .../camel/catalog/components/azure-servicebus.json |  8 +-
 .../component/azure/eventgrid/azure-eventgrid.json |  8 +-
 .../azure/eventgrid/EventGridComponent.java        | 10 ++-
 .../azure/eventgrid/EventGridConfiguration.java    | 14 +++-
 .../azure/eventgrid/EventGridProducer.java         |  5 +-
 .../eventgrid/EventGridTokenCredentialTest.java    | 97 ++++++++++++++++++++++
 .../component/azure/eventhubs/azure-eventhubs.json |  8 +-
 .../azure/eventhubs/EventHubsConfiguration.java    |  9 +-
 .../eventhubs/client/EventHubsClientFactory.java   | 16 +++-
 .../EventHubsClientFactoryCredentialTest.java      | 77 +++++++++++++++++
 .../azure/servicebus/azure-servicebus.json         |  8 +-
 .../azure/servicebus/ServiceBusConfiguration.java  |  9 +-
 .../servicebus/client/ServiceBusClientFactory.java |  4 +-
 .../ServiceBusClientFactoryCredentialTest.java     | 82 ++++++++++++++++++
 .../dsl/AzureEventhubsComponentBuilderFactory.java | 13 ++-
 .../AzureServicebusComponentBuilderFactory.java    | 12 ++-
 .../dsl/EventHubsEndpointBuilderFactory.java       | 78 +++++++++++++----
 .../dsl/ServiceBusEndpointBuilderFactory.java      | 72 +++++++++++++---
 19 files changed, 469 insertions(+), 69 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-eventhubs.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-eventhubs.json
index ffa1b21cb8dc..c00cecd96347 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-eventhubs.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-eventhubs.json
@@ -45,10 +45,10 @@
     "autowiredEnabled": { "index": 18, "kind": "property", "displayName": 
"Autowired Enabled", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether autowiring is enabled. This is used for automatic autowiring options 
(the option must be marked as autowired) by looking up in the registry to find 
if there is a single instance of matching  [...]
     "headerFilterStrategy": { "index": 19, "kind": "property", "displayName": 
"Header Filter Strategy", "group": "filter", "label": "filter", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": 
false, "secret": false, "description": "To use a custom 
org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel 
message." },
     "connectionString": { "index": 20, "kind": "property", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Instead of supplying 
namespace, sharedAccessKey, sharedAccessName, etc. you can sup [...]
-    "credentialType": { "index": 21, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigurat [...]
+    "credentialType": { "index": 21, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigurat [...]
     "sharedAccessKey": { "index": 22, "kind": "property", "displayName": 
"Shared Access Key", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The generated value for 
the SharedAccessName." },
     "sharedAccessName": { "index": 23, "kind": "property", "displayName": 
"Shared Access Name", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The name you chose for 
your EventHubs SAS keys." },
-    "tokenCredential": { "index": 24, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Provide custom 
authentication credenti [...]
+    "tokenCredential": { "index": 24, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenCre [...]
   },
   "headers": {
     "CamelAzureEventHubsPartitionKey": { "index": 0, "kind": "header", 
"displayName": "", "group": "common", "label": "", "required": false, 
"javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "description": "(producer) Overrides the hashing key to 
be provided for the batch of events, which instructs the Event Hubs service to 
map this key to a specific partition. (consumer) It sets the partition hashing 
key if it was set when originally  [...]
@@ -83,9 +83,9 @@
     "producerAsyncClient": { "index": 19, "kind": "parameter", "displayName": 
"Producer Async Client", "group": "producer", "label": "producer", "required": 
false, "type": "object", "javaType": 
"com.azure.messaging.eventhubs.EventHubProducerAsyncClient", "deprecated": 
false, "deprecationNote": "", "autowired": true, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Sets the Ev [...]
     "lazyStartProducer": { "index": 20, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
     "connectionString": { "index": 21, "kind": "parameter", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Instead of supplying 
namespace, sharedAccessKey, sharedAccessName, etc. you can su [...]
-    "credentialType": { "index": 22, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigura [...]
+    "credentialType": { "index": 22, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigura [...]
     "sharedAccessKey": { "index": 23, "kind": "parameter", "displayName": 
"Shared Access Key", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The generated value for 
the SharedAccessName." },
     "sharedAccessName": { "index": 24, "kind": "parameter", "displayName": 
"Shared Access Name", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The name you chose for 
your EventHubs SAS keys." },
-    "tokenCredential": { "index": 25, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Provide custom 
authentication credent [...]
+    "tokenCredential": { "index": 25, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenCr [...]
   }
 }
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
index 645e4266cc6d..06c91b9a84c3 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json
@@ -50,9 +50,9 @@
     "sessionId": { "index": 23, "kind": "property", "displayName": "Session 
Id", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Session ID for 
session-enabled queues or topics." },
     "autowiredEnabled": { "index": 24, "kind": "property", "displayName": 
"Autowired Enabled", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether autowiring is enabled. This is used for automatic autowiring options 
(the option must be marked as autowired) by looking up in the registry to find 
if there is a single instance of matching  [...]
     "connectionString": { "index": 25, "kind": "property", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Sets the connection 
string for a Service Bus namespace or a specific Service Bus  [...]
-    "credentialType": { "index": 26, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfigu [...]
+    "credentialType": { "index": 26, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfigu [...]
     "fullyQualifiedNamespace": { "index": 27, "kind": "property", 
"displayName": "Fully Qualified Namespace", "group": "security", "label": 
"security", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Fully Qualified 
Namespace of the service bus" },
-    "tokenCredential": { "index": 28, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "A TokenCredential for 
Azure AD authe [...]
+    "tokenCredential": { "index": 28, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenC [...]
   },
   "headers": {
     "CamelAzureServiceBusApplicationProperties": { "index": 0, "kind": 
"header", "displayName": "", "group": "common", "label": "common", "required": 
false, "javaType": "Map<String, Object>", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false, "description": "The 
application properties (also known as custom properties) on messages sent and 
received by the producer and consumer, respectively.", "constantName": 
"org.apache.camel.component.azure.servicebus.Servi [...]
@@ -109,8 +109,8 @@
     "sessionId": { "index": 24, "kind": "parameter", "displayName": "Session 
Id", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Session ID for 
session-enabled queues or topics." },
     "lazyStartProducer": { "index": 25, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
     "connectionString": { "index": 26, "kind": "parameter", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Sets the connection 
string for a Service Bus namespace or a specific Service Bus [...]
-    "credentialType": { "index": 27, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfig [...]
+    "credentialType": { "index": 27, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfig [...]
     "fullyQualifiedNamespace": { "index": 28, "kind": "parameter", 
"displayName": "Fully Qualified Namespace", "group": "security", "label": 
"security", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Fully Qualified 
Namespace of the service bus" },
-    "tokenCredential": { "index": 29, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "A TokenCredential for 
Azure AD auth [...]
+    "tokenCredential": { "index": 29, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.Token [...]
   }
 }
diff --git 
a/components/camel-azure/camel-azure-eventgrid/src/generated/resources/META-INF/org/apache/camel/component/azure/eventgrid/azure-eventgrid.json
 
b/components/camel-azure/camel-azure-eventgrid/src/generated/resources/META-INF/org/apache/camel/component/azure/eventgrid/azure-eventgrid.json
index 53edeee27748..e3a06fd7418d 100644
--- 
a/components/camel-azure/camel-azure-eventgrid/src/generated/resources/META-INF/org/apache/camel/component/azure/eventgrid/azure-eventgrid.json
+++ 
b/components/camel-azure/camel-azure-eventgrid/src/generated/resources/META-INF/org/apache/camel/component/azure/eventgrid/azure-eventgrid.json
@@ -30,8 +30,8 @@
     "autowiredEnabled": { "index": 3, "kind": "property", "displayName": 
"Autowired Enabled", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether autowiring is enabled. This is used for automatic autowiring options 
(the option must be marked as autowired) by looking up in the registry to find 
if there is a single instance of matching t [...]
     "accessKey": { "index": 4, "kind": "property", "displayName": "Access 
Key", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "The access key for the 
Event Grid topic. Required when using ACCESS_KEY credential type." },
     "azureKeyCredential": { "index": 5, "kind": "property", "displayName": 
"Azure Key Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.AzureKeyCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "The Azure Key Credential 
for  [...]
-    "credentialType": { "index": 6, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventgrid.CredentialType", "enum": [ 
"ACCESS_KEY", "AZURE_IDENTITY", "TOKEN_CREDENTIAL" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "ACCESS_KEY", 
"configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", "configur 
[...]
-    "tokenCredential": { "index": 7, "kind": "property", "displayName": "Token 
Credential", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": "com.azure.core.credential.TokenCredential", 
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": true, 
"configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "Provide custom 
authentication credentia [...]
+    "credentialType": { "index": 6, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventgrid.CredentialType", "enum": [ 
"ACCESS_KEY", "AZURE_IDENTITY", "TOKEN_CREDENTIAL" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "ACCESS_KEY", 
"configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", "configur 
[...]
+    "tokenCredential": { "index": 7, "kind": "property", "displayName": "Token 
Credential", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": "com.azure.core.credential.TokenCredential", 
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": true, 
"configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenCred [...]
   },
   "headers": {
     "CamelAzureEventGridEventType": { "index": 0, "kind": "header", 
"displayName": "", "group": "producer", "label": "", "required": false, 
"javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "description": "The event type of the event.", 
"constantName": 
"org.apache.camel.component.azure.eventgrid.EventGridConstants#EVENT_TYPE" },
@@ -46,7 +46,7 @@
     "lazyStartProducer": { "index": 2, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produc [...]
     "accessKey": { "index": 3, "kind": "parameter", "displayName": "Access 
Key", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "The access key for the 
Event Grid topic. Required when using ACCESS_KEY credential type." },
     "azureKeyCredential": { "index": 4, "kind": "parameter", "displayName": 
"Azure Key Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.AzureKeyCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "The Azure Key Credential 
for [...]
-    "credentialType": { "index": 5, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventgrid.CredentialType", "enum": [ 
"ACCESS_KEY", "AZURE_IDENTITY", "TOKEN_CREDENTIAL" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "ACCESS_KEY", 
"configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", "configu 
[...]
-    "tokenCredential": { "index": 6, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "Provide custom 
authentication credenti [...]
+    "credentialType": { "index": 5, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventgrid.CredentialType", "enum": [ 
"ACCESS_KEY", "AZURE_IDENTITY", "TOKEN_CREDENTIAL" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "ACCESS_KEY", 
"configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", "configu 
[...]
+    "tokenCredential": { "index": 6, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventgrid.EventGridConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenCre [...]
   }
 }
diff --git 
a/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridComponent.java
 
b/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridComponent.java
index 4c9ffee79df1..f5445805b0c4 100644
--- 
a/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridComponent.java
+++ 
b/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridComponent.java
@@ -61,9 +61,13 @@ public class EventGridComponent extends DefaultComponent {
                 
endpoint.getConfiguration().setCredentialType(CredentialType.AZURE_IDENTITY);
             }
         } else if (endpoint.getConfiguration().getTokenCredential() != null) {
-            boolean azure = endpoint.getConfiguration().getTokenCredential() 
instanceof DefaultAzureCredential;
-            endpoint.getConfiguration()
-                    .setCredentialType(azure ? CredentialType.AZURE_IDENTITY : 
CredentialType.TOKEN_CREDENTIAL);
+            // keep an explicit TOKEN_CREDENTIAL or AZURE_IDENTITY: both use 
the configured tokenCredential
+            CredentialType type = 
endpoint.getConfiguration().getCredentialType();
+            if (type != CredentialType.TOKEN_CREDENTIAL && type != 
CredentialType.AZURE_IDENTITY) {
+                boolean azure = 
endpoint.getConfiguration().getTokenCredential() instanceof 
DefaultAzureCredential;
+                endpoint.getConfiguration()
+                        .setCredentialType(azure ? 
CredentialType.AZURE_IDENTITY : CredentialType.TOKEN_CREDENTIAL);
+            }
         } else if (endpoint.getConfiguration().getAzureKeyCredential() != null
                 || endpoint.getConfiguration().getAccessKey() != null) {
             
endpoint.getConfiguration().setCredentialType(CredentialType.ACCESS_KEY);
diff --git 
a/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridConfiguration.java
 
b/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridConfiguration.java
index 545f0ffdfc64..f21237ecffa9 100644
--- 
a/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridConfiguration.java
+++ 
b/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridConfiguration.java
@@ -39,11 +39,21 @@ public class EventGridConfiguration implements Cloneable {
     @Metadata(autowired = true)
     private AzureKeyCredential azureKeyCredential;
 
-    @UriParam(label = "security", secret = true)
+    @UriParam(label = "security", secret = true,
+              description = "The com.azure.core.credential.TokenCredential 
that authenticates the producer with Microsoft"
+                            + " Entra ID, such as a DefaultAzureCredential 
built with a managed identity client id or a"
+                            + " tenant id; this instance is used as it is, 
also with credentialType AZURE_IDENTITY. When it"
+                            + " is set, the accessKey and azureKeyCredential 
options are not used.")
     @Metadata(autowired = true)
     private TokenCredential tokenCredential;
 
-    @UriParam(label = "security", enums = 
"ACCESS_KEY,AZURE_IDENTITY,TOKEN_CREDENTIAL", defaultValue = "ACCESS_KEY")
+    @UriParam(label = "security", enums = 
"ACCESS_KEY,AZURE_IDENTITY,TOKEN_CREDENTIAL", defaultValue = "ACCESS_KEY",
+              description = "How the producer authenticates: ACCESS_KEY with 
the azureKeyCredential or accessKey option,"
+                            + " TOKEN_CREDENTIAL with the tokenCredential 
option, or AZURE_IDENTITY with a"
+                            + " DefaultAzureCredential of the Azure Identity 
library (the tokenCredential option when it is"
+                            + " set, otherwise a new one). With 
tokenCredential set and this option left at ACCESS_KEY,"
+                            + " Camel uses AZURE_IDENTITY for a 
DefaultAzureCredential and TOKEN_CREDENTIAL for any other"
+                            + " credential. With only accessKey or 
azureKeyCredential set, Camel uses ACCESS_KEY.")
     private CredentialType credentialType = CredentialType.ACCESS_KEY;
 
     @UriParam(label = "producer")
diff --git 
a/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridProducer.java
 
b/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridProducer.java
index 5b0de8105eb5..c371bcc45975 100644
--- 
a/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridProducer.java
+++ 
b/components/camel-azure/camel-azure-eventgrid/src/main/java/org/apache/camel/component/azure/eventgrid/EventGridProducer.java
@@ -133,7 +133,10 @@ public class EventGridProducer extends DefaultProducer {
                 builder.credential(configuration.getTokenCredential());
                 break;
             case AZURE_IDENTITY:
-                builder.credential(new 
DefaultAzureCredentialBuilder().build());
+                // a DefaultAzureCredential set as tokenCredential (with a 
managed identity client id, a tenant id, ...)
+                // is used as is
+                builder.credential(configuration.getTokenCredential() != null
+                        ? configuration.getTokenCredential() : new 
DefaultAzureCredentialBuilder().build());
                 break;
             default:
                 throw new IllegalArgumentException("Unknown credential type: " 
+ configuration.getCredentialType());
diff --git 
a/components/camel-azure/camel-azure-eventgrid/src/test/java/org/apache/camel/component/azure/eventgrid/EventGridTokenCredentialTest.java
 
b/components/camel-azure/camel-azure-eventgrid/src/test/java/org/apache/camel/component/azure/eventgrid/EventGridTokenCredentialTest.java
new file mode 100644
index 000000000000..204cea08af7e
--- /dev/null
+++ 
b/components/camel-azure/camel-azure-eventgrid/src/test/java/org/apache/camel/component/azure/eventgrid/EventGridTokenCredentialTest.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.azure.eventgrid;
+
+import com.azure.core.credential.AzureKeyCredential;
+import com.azure.core.credential.TokenCredential;
+import com.azure.identity.DefaultAzureCredential;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import com.azure.messaging.eventgrid.EventGridPublisherClientBuilder;
+import org.apache.camel.Producer;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedConstruction;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.RETURNS_SELF;
+import static org.mockito.Mockito.mockConstruction;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.withSettings;
+
+/**
+ * A DefaultAzureCredential set as tokenCredential is the credential of the 
publisher client.
+ */
+class EventGridTokenCredentialTest extends CamelTestSupport {
+
+    private static final String TOPIC = 
"azure-eventgrid:https://mytopic.eventgrid.azure.net/api/events";;
+
+    @Test
+    void defaultAzureCredentialIsUsed() throws Exception {
+        DefaultAzureCredential credential = new 
DefaultAzureCredentialBuilder().managedIdentityClientId("my-id").build();
+        context.getRegistry().bind("cred", credential);
+
+        EventGridEndpoint endpoint = context.getEndpoint(TOPIC + 
"?tokenCredential=#cred", EventGridEndpoint.class);
+        assertEquals(CredentialType.AZURE_IDENTITY, 
endpoint.getConfiguration().getCredentialType());
+
+        assertCredentialOfClient(endpoint, credential);
+    }
+
+    @Test
+    void explicitTokenCredentialTypeIsKept() throws Exception {
+        DefaultAzureCredential credential = new 
DefaultAzureCredentialBuilder().tenantId("my-tenant").build();
+        context.getRegistry().bind("cred", credential);
+
+        EventGridEndpoint endpoint = context.getEndpoint(TOPIC + 
"?tokenCredential=#cred&credentialType=TOKEN_CREDENTIAL",
+                EventGridEndpoint.class);
+        assertEquals(CredentialType.TOKEN_CREDENTIAL, 
endpoint.getConfiguration().getCredentialType());
+
+        assertCredentialOfClient(endpoint, credential);
+    }
+
+    @Test
+    void azureIdentityWithoutTokenCredentialBuildsOne() throws Exception {
+        EventGridEndpoint endpoint = context.getEndpoint(TOPIC + 
"?credentialType=AZURE_IDENTITY", EventGridEndpoint.class);
+
+        try (MockedConstruction<EventGridPublisherClientBuilder> builders
+                = mockConstruction(EventGridPublisherClientBuilder.class, 
withSettings().defaultAnswer(RETURNS_SELF))) {
+            Producer producer = endpoint.createProducer();
+            producer.start();
+            producer.stop();
+
+            
verify(builders.constructed().get(0)).credential(any(DefaultAzureCredential.class));
+        }
+    }
+
+    private static void assertCredentialOfClient(EventGridEndpoint endpoint, 
TokenCredential credential) throws Exception {
+        try (MockedConstruction<EventGridPublisherClientBuilder> builders
+                = mockConstruction(EventGridPublisherClientBuilder.class, 
withSettings().defaultAnswer(RETURNS_SELF))) {
+            Producer producer = endpoint.createProducer();
+            producer.start();
+            producer.stop();
+
+            assertEquals(1, builders.constructed().size());
+            EventGridPublisherClientBuilder builder = 
builders.constructed().get(0);
+            verify(builder).credential(same(credential));
+            verify(builder, never()).credential(any(AzureKeyCredential.class));
+        }
+        assertSame(credential, 
endpoint.getConfiguration().getTokenCredential());
+    }
+}
diff --git 
a/components/camel-azure/camel-azure-eventhubs/src/generated/resources/META-INF/org/apache/camel/component/azure/eventhubs/azure-eventhubs.json
 
b/components/camel-azure/camel-azure-eventhubs/src/generated/resources/META-INF/org/apache/camel/component/azure/eventhubs/azure-eventhubs.json
index ffa1b21cb8dc..c00cecd96347 100644
--- 
a/components/camel-azure/camel-azure-eventhubs/src/generated/resources/META-INF/org/apache/camel/component/azure/eventhubs/azure-eventhubs.json
+++ 
b/components/camel-azure/camel-azure-eventhubs/src/generated/resources/META-INF/org/apache/camel/component/azure/eventhubs/azure-eventhubs.json
@@ -45,10 +45,10 @@
     "autowiredEnabled": { "index": 18, "kind": "property", "displayName": 
"Autowired Enabled", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether autowiring is enabled. This is used for automatic autowiring options 
(the option must be marked as autowired) by looking up in the registry to find 
if there is a single instance of matching  [...]
     "headerFilterStrategy": { "index": 19, "kind": "property", "displayName": 
"Header Filter Strategy", "group": "filter", "label": "filter", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": 
false, "secret": false, "description": "To use a custom 
org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel 
message." },
     "connectionString": { "index": 20, "kind": "property", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Instead of supplying 
namespace, sharedAccessKey, sharedAccessName, etc. you can sup [...]
-    "credentialType": { "index": 21, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigurat [...]
+    "credentialType": { "index": 21, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigurat [...]
     "sharedAccessKey": { "index": 22, "kind": "property", "displayName": 
"Shared Access Key", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The generated value for 
the SharedAccessName." },
     "sharedAccessName": { "index": 23, "kind": "property", "displayName": 
"Shared Access Name", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The name you chose for 
your EventHubs SAS keys." },
-    "tokenCredential": { "index": 24, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Provide custom 
authentication credenti [...]
+    "tokenCredential": { "index": 24, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenCre [...]
   },
   "headers": {
     "CamelAzureEventHubsPartitionKey": { "index": 0, "kind": "header", 
"displayName": "", "group": "common", "label": "", "required": false, 
"javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "description": "(producer) Overrides the hashing key to 
be provided for the batch of events, which instructs the Event Hubs service to 
map this key to a specific partition. (consumer) It sets the partition hashing 
key if it was set when originally  [...]
@@ -83,9 +83,9 @@
     "producerAsyncClient": { "index": 19, "kind": "parameter", "displayName": 
"Producer Async Client", "group": "producer", "label": "producer", "required": 
false, "type": "object", "javaType": 
"com.azure.messaging.eventhubs.EventHubProducerAsyncClient", "deprecated": 
false, "deprecationNote": "", "autowired": true, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Sets the Ev [...]
     "lazyStartProducer": { "index": 20, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
     "connectionString": { "index": 21, "kind": "parameter", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Instead of supplying 
namespace, sharedAccessKey, sharedAccessName, etc. you can su [...]
-    "credentialType": { "index": 22, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigura [...]
+    "credentialType": { "index": 22, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.eventhubs.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfigura [...]
     "sharedAccessKey": { "index": 23, "kind": "parameter", "displayName": 
"Shared Access Key", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The generated value for 
the SharedAccessName." },
     "sharedAccessName": { "index": 24, "kind": "parameter", "displayName": 
"Shared Access Name", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The name you chose for 
your EventHubs SAS keys." },
-    "tokenCredential": { "index": 25, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "Provide custom 
authentication credent [...]
+    "tokenCredential": { "index": 25, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.eventhubs.EventHubsConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenCr [...]
   }
 }
diff --git 
a/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/EventHubsConfiguration.java
 
b/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/EventHubsConfiguration.java
index a4065c015408..bc143bc303c3 100644
--- 
a/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/EventHubsConfiguration.java
+++ 
b/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/EventHubsConfiguration.java
@@ -144,7 +144,9 @@ public class EventHubsConfiguration implements Cloneable {
     }
 
     /**
-     * Provide custom authentication credentials using an implementation of 
{@link TokenCredential}.
+     * The com.azure.core.credential.TokenCredential to authenticate with 
Microsoft Entra ID, for credentialType
+     * TOKEN_CREDENTIAL or AZURE_IDENTITY. A DefaultAzureCredential built with 
a managed identity client id or a tenant
+     * id is used as it is.
      */
     public TokenCredential getTokenCredential() {
         return tokenCredential;
@@ -358,7 +360,10 @@ public class EventHubsConfiguration implements Cloneable {
     }
 
     /**
-     * Determines the credential strategy to adopt
+     * Determines the credential strategy to adopt: CONNECTION_STRING, 
TOKEN_CREDENTIAL with the tokenCredential option,
+     * or AZURE_IDENTITY with a DefaultAzureCredential: the tokenCredential 
option when it is set, otherwise a new one.
+     * When tokenCredential is set, the component sets AZURE_IDENTITY for a 
DefaultAzureCredential and TOKEN_CREDENTIAL
+     * for any other credential; otherwise the default is CONNECTION_STRING.
      */
     public void setCredentialType(CredentialType credentialType) {
         this.credentialType = credentialType;
diff --git 
a/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/client/EventHubsClientFactory.java
 
b/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/client/EventHubsClientFactory.java
index f88717894add..dedd414eec5d 100644
--- 
a/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/client/EventHubsClientFactory.java
+++ 
b/components/camel-azure/camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs/client/EventHubsClientFactory.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.azure.eventhubs.client;
 import java.util.Locale;
 import java.util.function.Consumer;
 
+import com.azure.core.credential.TokenCredential;
 import com.azure.identity.DefaultAzureCredentialBuilder;
 import com.azure.messaging.eventhubs.CheckpointStore;
 import com.azure.messaging.eventhubs.EventHubClientBuilder;
@@ -69,7 +70,7 @@ public final class EventHubsClientFactory {
         return eventHubClientBuilder
                 
.fullyQualifiedNamespace(getFullyQualifiedNamespace(configuration))
                 .eventHubName(configuration.getEventHubName())
-                .credential(new DefaultAzureCredentialBuilder().build())
+                .credential(azureIdentityCredential(configuration))
                 .buildAsyncProducerClient();
     }
 
@@ -100,7 +101,7 @@ public final class EventHubsClientFactory {
         return eventHubClientBuilder
                 
.fullyQualifiedNamespace(getFullyQualifiedNamespace(configuration))
                 .eventHubName(configuration.getEventHubName())
-                .credential(new DefaultAzureCredentialBuilder().build())
+                .credential(azureIdentityCredential(configuration))
                 .buildAsyncConsumerClient();
     }
 
@@ -136,10 +137,19 @@ public final class EventHubsClientFactory {
         return eventProcessorClientBuilder
                 
.fullyQualifiedNamespace(getFullyQualifiedNamespace(configuration))
                 .eventHubName(configuration.getEventHubName())
-                .credential(new DefaultAzureCredentialBuilder().build())
+                .credential(azureIdentityCredential(configuration))
                 .buildEventProcessorClient();
     }
 
+    /**
+     * The credential for AZURE_IDENTITY: the tokenCredential when it is set 
(such as a DefaultAzureCredential with a
+     * managed identity client id or a tenant id), otherwise a new 
DefaultAzureCredential.
+     */
+    static TokenCredential azureIdentityCredential(final 
EventHubsConfiguration configuration) {
+        TokenCredential credential = configuration.getTokenCredential();
+        return credential != null ? credential : new 
DefaultAzureCredentialBuilder().build();
+    }
+
     // public for testing purposes
     public static BlobContainerAsyncClient createBlobContainerClient(final 
EventHubsConfiguration configuration) {
         return new BlobContainerClientBuilder()
diff --git 
a/components/camel-azure/camel-azure-eventhubs/src/test/java/org/apache/camel/component/azure/eventhubs/client/EventHubsClientFactoryCredentialTest.java
 
b/components/camel-azure/camel-azure-eventhubs/src/test/java/org/apache/camel/component/azure/eventhubs/client/EventHubsClientFactoryCredentialTest.java
new file mode 100644
index 000000000000..0545c892b284
--- /dev/null
+++ 
b/components/camel-azure/camel-azure-eventhubs/src/test/java/org/apache/camel/component/azure/eventhubs/client/EventHubsClientFactoryCredentialTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.azure.eventhubs.client;
+
+import com.azure.identity.DefaultAzureCredential;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import com.azure.messaging.eventhubs.EventHubClientBuilder;
+import org.apache.camel.component.azure.eventhubs.CredentialType;
+import org.apache.camel.component.azure.eventhubs.EventHubsConfiguration;
+import org.apache.camel.component.azure.eventhubs.EventHubsEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedConstruction;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.RETURNS_SELF;
+import static org.mockito.Mockito.mockConstruction;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.withSettings;
+
+/**
+ * A DefaultAzureCredential set as tokenCredential is the credential of the 
clients. With no credentialType, the
+ * component chooses AZURE_IDENTITY for it.
+ */
+class EventHubsClientFactoryCredentialTest extends CamelTestSupport {
+
+    @Test
+    void defaultAzureCredentialAsTokenCredentialIsUsed() {
+        DefaultAzureCredential credential = new 
DefaultAzureCredentialBuilder().managedIdentityClientId("my-id").build();
+        context.getRegistry().bind("cred", credential);
+
+        // no credentialType: the component sets AZURE_IDENTITY for a 
DefaultAzureCredential
+        EventHubsConfiguration configuration = context.getEndpoint(
+                "azure-eventhubs:mynamespace/myhub?tokenCredential=#cred", 
EventHubsEndpoint.class).getConfiguration();
+        assertEquals(CredentialType.AZURE_IDENTITY, 
configuration.getCredentialType());
+
+        try (MockedConstruction<EventHubClientBuilder> builders
+                = mockConstruction(EventHubClientBuilder.class, 
withSettings().defaultAnswer(RETURNS_SELF))) {
+            
EventHubsClientFactory.createEventHubProducerAsyncClient(configuration);
+            
EventHubsClientFactory.createEventHubConsumerAsyncClient(configuration);
+
+            assertEquals(2, builders.constructed().size());
+            verify(builders.constructed().get(0)).credential(same(credential));
+            verify(builders.constructed().get(1)).credential(same(credential));
+        }
+    }
+
+    @Test
+    void azureIdentityWithoutTokenCredentialBuildsOne() {
+        EventHubsConfiguration configuration = context.getEndpoint(
+                
"azure-eventhubs:mynamespace/myhub?credentialType=AZURE_IDENTITY", 
EventHubsEndpoint.class)
+                .getConfiguration();
+
+        try (MockedConstruction<EventHubClientBuilder> builders
+                = mockConstruction(EventHubClientBuilder.class, 
withSettings().defaultAnswer(RETURNS_SELF))) {
+            
EventHubsClientFactory.createEventHubProducerAsyncClient(configuration);
+
+            
verify(builders.constructed().get(0)).credential(any(DefaultAzureCredential.class));
+        }
+    }
+}
diff --git 
a/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json
 
b/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json
index 645e4266cc6d..06c91b9a84c3 100644
--- 
a/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json
+++ 
b/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json
@@ -50,9 +50,9 @@
     "sessionId": { "index": 23, "kind": "property", "displayName": "Session 
Id", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Session ID for 
session-enabled queues or topics." },
     "autowiredEnabled": { "index": 24, "kind": "property", "displayName": 
"Autowired Enabled", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether autowiring is enabled. This is used for automatic autowiring options 
(the option must be marked as autowired) by looking up in the registry to find 
if there is a single instance of matching  [...]
     "connectionString": { "index": 25, "kind": "property", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Sets the connection 
string for a Service Bus namespace or a specific Service Bus  [...]
-    "credentialType": { "index": 26, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfigu [...]
+    "credentialType": { "index": 26, "kind": "property", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfigu [...]
     "fullyQualifiedNamespace": { "index": 27, "kind": "property", 
"displayName": "Fully Qualified Namespace", "group": "security", "label": 
"security", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Fully Qualified 
Namespace of the service bus" },
-    "tokenCredential": { "index": 28, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "A TokenCredential for 
Azure AD authe [...]
+    "tokenCredential": { "index": 28, "kind": "property", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.TokenC [...]
   },
   "headers": {
     "CamelAzureServiceBusApplicationProperties": { "index": 0, "kind": 
"header", "displayName": "", "group": "common", "label": "common", "required": 
false, "javaType": "Map<String, Object>", "deprecated": false, 
"deprecationNote": "", "autowired": false, "secret": false, "description": "The 
application properties (also known as custom properties) on messages sent and 
received by the producer and consumer, respectively.", "constantName": 
"org.apache.camel.component.azure.servicebus.Servi [...]
@@ -109,8 +109,8 @@
     "sessionId": { "index": 24, "kind": "parameter", "displayName": "Session 
Id", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Session ID for 
session-enabled queues or topics." },
     "lazyStartProducer": { "index": 25, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
     "connectionString": { "index": 26, "kind": "parameter", "displayName": 
"Connection String", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Sets the connection 
string for a Service Bus namespace or a specific Service Bus [...]
-    "credentialType": { "index": 27, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfig [...]
+    "credentialType": { "index": 27, "kind": "parameter", "displayName": 
"Credential Type", "group": "security", "label": "security", "required": false, 
"type": "enum", "javaType": 
"org.apache.camel.component.azure.servicebus.CredentialType", "enum": [ 
"AZURE_IDENTITY", "CONNECTION_STRING", "TOKEN_CREDENTIAL" ], "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": 
"CONNECTION_STRING", "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfig [...]
     "fullyQualifiedNamespace": { "index": 28, "kind": "parameter", 
"displayName": "Fully Qualified Namespace", "group": "security", "label": 
"security", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "Fully Qualified 
Namespace of the service bus" },
-    "tokenCredential": { "index": 29, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "A TokenCredential for 
Azure AD auth [...]
+    "tokenCredential": { "index": 29, "kind": "parameter", "displayName": 
"Token Credential", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"com.azure.core.credential.TokenCredential", "deprecated": false, 
"deprecationNote": "", "autowired": true, "secret": true, "configurationClass": 
"org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", 
"configurationField": "configuration", "description": "The 
com.azure.core.credential.Token [...]
   }
 }
diff --git 
a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
 
b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
index 399f81ed5d1d..52b327dd9866 100644
--- 
a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
+++ 
b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java
@@ -327,7 +327,9 @@ public class ServiceBusConfiguration implements Cloneable, 
HeaderFilterStrategyA
     }
 
     /**
-     * A TokenCredential for Azure AD authentication.
+     * The com.azure.core.credential.TokenCredential to authenticate with 
Microsoft Entra ID, for credentialType
+     * TOKEN_CREDENTIAL or AZURE_IDENTITY. A DefaultAzureCredential built with 
a managed identity client id or a tenant
+     * id is used as it is.
      */
     public TokenCredential getTokenCredential() {
         return tokenCredential;
@@ -386,7 +388,10 @@ public class ServiceBusConfiguration implements Cloneable, 
HeaderFilterStrategyA
     }
 
     /**
-     * Determines the credential strategy to adopt
+     * Determines the credential strategy to adopt: CONNECTION_STRING, 
TOKEN_CREDENTIAL with the tokenCredential option,
+     * or AZURE_IDENTITY with a DefaultAzureCredential: the tokenCredential 
option when it is set, otherwise a new one.
+     * When tokenCredential is set, the component sets AZURE_IDENTITY for a 
DefaultAzureCredential and TOKEN_CREDENTIAL
+     * for any other credential; otherwise the default is CONNECTION_STRING.
      */
     public void setCredentialType(CredentialType credentialType) {
         this.credentialType = credentialType;
diff --git 
a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactory.java
 
b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactory.java
index 91ea8ab77d41..64b2636927c8 100644
--- 
a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactory.java
+++ 
b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactory.java
@@ -45,7 +45,9 @@ public final class ServiceBusClientFactory {
         switch (type) {
             case CONNECTION_STRING -> 
builder.connectionString(configuration.getConnectionString());
             case TOKEN_CREDENTIAL -> 
builder.credential(fullyQualifiedNamespace, credential);
-            case AZURE_IDENTITY -> builder.credential(fullyQualifiedNamespace, 
new DefaultAzureCredentialBuilder().build());
+            // a DefaultAzureCredential set as tokenCredential (with a managed 
identity client id, a tenant id, ...) is used as is
+            case AZURE_IDENTITY -> builder.credential(fullyQualifiedNamespace,
+                    credential != null ? credential : new 
DefaultAzureCredentialBuilder().build());
         }
 
         return builder;
diff --git 
a/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactoryCredentialTest.java
 
b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactoryCredentialTest.java
new file mode 100644
index 000000000000..797805387d46
--- /dev/null
+++ 
b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/client/ServiceBusClientFactoryCredentialTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.azure.servicebus.client;
+
+import com.azure.identity.DefaultAzureCredential;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import com.azure.messaging.servicebus.ServiceBusClientBuilder;
+import org.apache.camel.component.azure.servicebus.CredentialType;
+import org.apache.camel.component.azure.servicebus.ServiceBusConfiguration;
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedConstruction;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.RETURNS_SELF;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockConstruction;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.withSettings;
+
+/**
+ * A DefaultAzureCredential set as tokenCredential is the credential of the 
client with AZURE_IDENTITY.
+ */
+class ServiceBusClientFactoryCredentialTest {
+
+    private static final String NAMESPACE = 
"mynamespace.servicebus.windows.net";
+
+    @Test
+    void azureIdentityUsesTheTokenCredential() {
+        DefaultAzureCredential credential = new 
DefaultAzureCredentialBuilder().managedIdentityClientId("my-id").build();
+        ServiceBusConfiguration configuration = configuration();
+        configuration.setTokenCredential(credential);
+
+        ServiceBusClientBuilder builder = buildSenderClient(configuration);
+
+        verify(builder).credential(eq(NAMESPACE), same(credential));
+    }
+
+    @Test
+    void azureIdentityWithoutTokenCredentialBuildsOne() {
+        ServiceBusClientBuilder builder = buildSenderClient(configuration());
+
+        verify(builder).credential(eq(NAMESPACE), 
any(DefaultAzureCredential.class));
+    }
+
+    private static ServiceBusConfiguration configuration() {
+        ServiceBusConfiguration configuration = new ServiceBusConfiguration();
+        configuration.setCredentialType(CredentialType.AZURE_IDENTITY);
+        configuration.setFullyQualifiedNamespace(NAMESPACE);
+        configuration.setTopicOrQueueName("myqueue");
+        return configuration;
+    }
+
+    private static ServiceBusClientBuilder 
buildSenderClient(ServiceBusConfiguration configuration) {
+        ServiceBusClientBuilder.ServiceBusSenderClientBuilder sender
+                = 
mock(ServiceBusClientBuilder.ServiceBusSenderClientBuilder.class, RETURNS_SELF);
+        try (MockedConstruction<ServiceBusClientBuilder> builders = 
mockConstruction(ServiceBusClientBuilder.class,
+                withSettings().defaultAnswer(RETURNS_SELF), (mock, context) -> 
when(mock.sender()).thenReturn(sender))) {
+            new 
ServiceBusClientFactory().createServiceBusSenderClient(configuration);
+
+            assertEquals(1, builders.constructed().size());
+            return builders.constructed().get(0);
+        }
+    }
+}
diff --git 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureEventhubsComponentBuilderFactory.java
 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureEventhubsComponentBuilderFactory.java
index 96464f8aed28..545f73e2da40 100644
--- 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureEventhubsComponentBuilderFactory.java
+++ 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureEventhubsComponentBuilderFactory.java
@@ -469,7 +469,12 @@ public interface AzureEventhubsComponentBuilderFactory {
     
         
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
&lt;code&gt;org.apache.camel.component.azure.eventhubs.CredentialType&lt;/code&gt;
 type.
@@ -516,8 +521,10 @@ public interface AzureEventhubsComponentBuilderFactory {
         }
     
         /**
-         * Provide custom authentication credentials using an implementation of
-         * TokenCredential.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * &lt;code&gt;com.azure.core.credential.TokenCredential&lt;/code&gt;
diff --git 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java
 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java
index e14697d1ddd0..29eb9b2176a7 100644
--- 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java
+++ 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java
@@ -530,7 +530,12 @@ public interface AzureServicebusComponentBuilderFactory {
     
         
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
&lt;code&gt;org.apache.camel.component.azure.servicebus.CredentialType&lt;/code&gt;
 type.
@@ -562,7 +567,10 @@ public interface AzureServicebusComponentBuilderFactory {
         }
     
         /**
-         * A TokenCredential for Azure AD authentication.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * &lt;code&gt;com.azure.core.credential.TokenCredential&lt;/code&gt;
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventHubsEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventHubsEndpointBuilderFactory.java
index 903c711415aa..20088c52f5d8 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventHubsEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventHubsEndpointBuilderFactory.java
@@ -408,7 +408,12 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
<code>org.apache.camel.component.azure.eventhubs.CredentialType</code> type.
@@ -424,7 +429,12 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option will be converted to a
          * 
<code>org.apache.camel.component.azure.eventhubs.CredentialType</code> type.
@@ -468,8 +478,10 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Provide custom authentication credentials using an implementation of
-         * TokenCredential.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -484,8 +496,10 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Provide custom authentication credentials using an implementation of
-         * TokenCredential.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option will be converted to a
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -812,7 +826,12 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
<code>org.apache.camel.component.azure.eventhubs.CredentialType</code> type.
@@ -828,7 +847,12 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option will be converted to a
          * 
<code>org.apache.camel.component.azure.eventhubs.CredentialType</code> type.
@@ -872,8 +896,10 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Provide custom authentication credentials using an implementation of
-         * TokenCredential.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -888,8 +914,10 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Provide custom authentication credentials using an implementation of
-         * TokenCredential.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option will be converted to a
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -1058,7 +1086,12 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
<code>org.apache.camel.component.azure.eventhubs.CredentialType</code> type.
@@ -1074,7 +1107,12 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option will be converted to a
          * 
<code>org.apache.camel.component.azure.eventhubs.CredentialType</code> type.
@@ -1118,8 +1156,10 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Provide custom authentication credentials using an implementation of
-         * TokenCredential.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -1134,8 +1174,10 @@ public interface EventHubsEndpointBuilderFactory {
             return this;
         }
         /**
-         * Provide custom authentication credentials using an implementation of
-         * TokenCredential.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option will be converted to a
          * <code>com.azure.core.credential.TokenCredential</code> type.
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
index f3ac265a093e..d6208a235e5d 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java
@@ -538,7 +538,12 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
<code>org.apache.camel.component.azure.servicebus.CredentialType</code> type.
@@ -554,7 +559,12 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option will be converted to a
          * 
<code>org.apache.camel.component.azure.servicebus.CredentialType</code> type.
@@ -584,7 +594,10 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * A TokenCredential for Azure AD authentication.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -599,7 +612,10 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * A TokenCredential for Azure AD authentication.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option will be converted to a
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -1142,7 +1158,12 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
<code>org.apache.camel.component.azure.servicebus.CredentialType</code> type.
@@ -1158,7 +1179,12 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option will be converted to a
          * 
<code>org.apache.camel.component.azure.servicebus.CredentialType</code> type.
@@ -1188,7 +1214,10 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * A TokenCredential for Azure AD authentication.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -1203,7 +1232,10 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * A TokenCredential for Azure AD authentication.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option will be converted to a
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -1502,7 +1534,12 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option is a:
          * 
<code>org.apache.camel.component.azure.servicebus.CredentialType</code> type.
@@ -1518,7 +1555,12 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * Determines the credential strategy to adopt.
+         * Determines the credential strategy to adopt: CONNECTION_STRING,
+         * TOKEN_CREDENTIAL with the tokenCredential option, or AZURE_IDENTITY
+         * with a DefaultAzureCredential: the tokenCredential option when it is
+         * set, otherwise a new one. When tokenCredential is set, the component
+         * sets AZURE_IDENTITY for a DefaultAzureCredential and 
TOKEN_CREDENTIAL
+         * for any other credential; otherwise the default is 
CONNECTION_STRING.
          * 
          * The option will be converted to a
          * 
<code>org.apache.camel.component.azure.servicebus.CredentialType</code> type.
@@ -1548,7 +1590,10 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * A TokenCredential for Azure AD authentication.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option is a:
          * <code>com.azure.core.credential.TokenCredential</code> type.
@@ -1563,7 +1608,10 @@ public interface ServiceBusEndpointBuilderFactory {
             return this;
         }
         /**
-         * A TokenCredential for Azure AD authentication.
+         * The com.azure.core.credential.TokenCredential to authenticate with
+         * Microsoft Entra ID, for credentialType TOKEN_CREDENTIAL or
+         * AZURE_IDENTITY. A DefaultAzureCredential built with a managed
+         * identity client id or a tenant id is used as it is.
          * 
          * The option will be converted to a
          * <code>com.azure.core.credential.TokenCredential</code> type.

Reply via email to