You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2023/12/14 14:15:47 UTC

(camel) branch main updated (267a9882b33 -> 6a5b3e5e551)

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

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 267a9882b33 Fix to configurable mongodb image (#12449)
     new 0b59aa0d6fc CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus
     new 9e3eb534d04 CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Docs
     new 038a60f26ae CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Migration Docs
     new 6a5b3e5e551 CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Tests

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/catalog/components/azure-servicebus.json | 10 ++++----
 .../servicebus/ServiceBusComponentConfigurer.java  |  6 +++++
 .../servicebus/ServiceBusEndpointConfigurer.java   |  6 +++++
 .../servicebus/ServiceBusEndpointUriFactory.java   |  3 ++-
 .../azure/servicebus/azure-servicebus.json         | 10 ++++----
 .../src/main/docs/azure-servicebus-component.adoc  | 19 +++++++++++++++
 .../azure/servicebus}/CredentialType.java          |  6 ++---
 .../azure/servicebus/ServiceBusComponent.java      |  3 ---
 .../azure/servicebus/ServiceBusConfiguration.java  | 16 +++++++++++++
 .../servicebus/client/ServiceBusClientFactory.java | 14 +++++++----
 .../azure/servicebus/ServiceBusEndpointTest.java   | 27 ++++++++++++++++++++--
 .../ROOT/pages/camel-4x-upgrade-guide-4_4.adoc     |  8 +++++++
 12 files changed, 107 insertions(+), 21 deletions(-)
 copy components/camel-azure/{camel-azure-eventhubs/src/main/java/org/apache/camel/component/azure/eventhubs => camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus}/CredentialType.java (90%)


(camel) 02/04: CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Docs

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9e3eb534d0464d50151785ed1f33a23c98499b8a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 14 14:29:44 2023 +0100

    CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Docs
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../src/main/docs/azure-servicebus-component.adoc     | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc b/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc
index 74d63e78cef..66894983be0 100644
--- a/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc
+++ b/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc
@@ -61,6 +61,25 @@ This allows camel route to consume and produce events asynchronously without blo
 include::partial$component-endpoint-headers.adoc[]
 // component headers: END
 
+=== Authentication Information
+
+You have three different Credential Types: AZURE_IDENTITY, TOKEN_CREDENTIAL and CONNECTION_STRING. You can also provide a client instance yourself.
+To use this component, you have 3 options in order to provide the required Azure authentication information:
+
+CONNECTION_STRING:
+- Provide `connectionString` string it is the simplest option to get started.
+
+TOKEN_CREDENTIAL:
+- Provide an implementation of `com.azure.core.credential.TokenCredential` into the Camel's Registry, e.g. using the `com.azure.identity.DefaultAzureCredentialBuilder().build();` API.
+See the documentation https://docs.microsoft.com/en-us/azure/active-directory/authentication/overview-authentication[here about Azure-AD authentication].
+
+AZURE_IDENTITY:
+- This will use `com.azure.identity.DefaultAzureCredentialBuilder().build();` instance. This will follow the Default Azure Credential Chain.
+See the documentation https://docs.microsoft.com/en-us/azure/active-directory/authentication/overview-authentication[here about Azure-AD authentication].
+
+Client instance:
+- You can provide a `com.azure.messaging.servicebus.ServiceBusSenderAsyncClient` for sending message and/or `com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient` to receive messages. If you provide the instances they will be autowired.
+
 === Message Body
 In the producer, this component accepts message body of `String`, `byte[]` and `BinaryData` types or `List<String>`, `List<byte[]>` and `List<BinaryData>` to send batch messages.
 


(camel) 03/04: CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Migration Docs

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 038a60f26ae10e5cf2d67eb19e0c3f998b36eaa5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 14 14:35:34 2023 +0100

    CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Migration Docs
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc            | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc
index ed29cc15f57..e9d33a5b449 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_4.adoc
@@ -23,3 +23,11 @@ With the CONNECTION_STRING mode the user could explicitly set the connectionStri
 With the TOKEN_CREDENTIAL mode the user could pass a TokenCredential instance.
 With the AZURE_IDENTITY mode the user will be able to use the Default Azure Credentials Chain.
 This is part of the effort explained in CAMEL-18590.
+
+=== camel-azure-servicebus
+
+The credentialType parameter has been introduced with three possible values: AZURE_IDENTITY, CONNECTION_STRING and TOKEN_CREDENTIAL.
+With the CONNECTION_STRING mode the user could explicitly set the connectionString parameter.
+With the TOKEN_CREDENTIAL mode the user could pass a TokenCredential instance.
+With the AZURE_IDENTITY mode the user will be able to use the Default Azure Credentials Chain.
+This is part of the effort explained in CAMEL-18590.


(camel) 04/04: CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Tests

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 6a5b3e5e551307a123144f02f3df2f7cee454a07
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 14 14:46:54 2023 +0100

    CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus - Tests
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../azure/servicebus/ServiceBusComponent.java      |  3 ---
 .../azure/servicebus/ServiceBusConfiguration.java  |  3 +--
 .../azure/servicebus/ServiceBusEndpointTest.java   | 27 ++++++++++++++++++++--
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusComponent.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusComponent.java
index e4f38adccc4..5e314007743 100644
--- a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusComponent.java
+++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusComponent.java
@@ -20,7 +20,6 @@ import java.util.Map;
 import java.util.Set;
 
 import com.azure.core.credential.TokenCredential;
-import com.azure.identity.DefaultAzureCredentialBuilder;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.spi.Metadata;
@@ -73,8 +72,6 @@ public class ServiceBusComponent extends DefaultComponent {
             // Find exactly one from the registry or create one
             if (tokenCredentialFromRegistry.size() == 1) {
                 configuration.setTokenCredential(tokenCredentialFromRegistry.stream().findFirst().get());
-            } else {
-                configuration.setTokenCredential(new DefaultAzureCredentialBuilder().build());
             }
         }
     }
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 ad77caeec0e..4350cd83c4b 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
@@ -90,7 +90,7 @@ public class ServiceBusConfiguration implements Cloneable {
     @UriParam(label = "producer", defaultValue = "false")
     private boolean binary;
     @UriParam(label = "security", enums = "AZURE_IDENTITY,CONNECTION_STRING,TOKEN_CREDENTIAL",
-            defaultValue = "CONNECTION_STRING")
+              defaultValue = "CONNECTION_STRING")
     private CredentialType credentialType = CONNECTION_STRING;
 
     /**
@@ -358,7 +358,6 @@ public class ServiceBusConfiguration implements Cloneable {
         this.binary = binary;
     }
 
-
     public CredentialType getCredentialType() {
         return credentialType;
     }
diff --git a/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java
index f3a4831a5d9..58efbd71c03 100644
--- a/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java
+++ b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java
@@ -26,7 +26,7 @@ import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 class ServiceBusEndpointTest extends CamelTestSupport {
@@ -83,7 +83,7 @@ class ServiceBusEndpointTest extends CamelTestSupport {
         assertEquals("testTopicOrQueue", endpoint.getConfiguration().getTopicOrQueueName());
         assertEquals(10, endpoint.getConfiguration().getPrefetchCount());
         assertEquals(fullyQualifiedNamespace, endpoint.getConfiguration().getFullyQualifiedNamespace());
-        assertNotNull(endpoint.getConfiguration().getTokenCredential());
+        assertNull(endpoint.getConfiguration().getTokenCredential());
     }
 
     @Test
@@ -131,4 +131,27 @@ class ServiceBusEndpointTest extends CamelTestSupport {
         assertEquals(fullyQualifiedNamespace, endpoint.getConfiguration().getFullyQualifiedNamespace());
         assertEquals(credential, endpoint.getConfiguration().getTokenCredential());
     }
+
+    @Test
+    void testCreateEndpointWithAzureIdentity() throws Exception {
+        final String uri = "azure-servicebus://testTopicOrQueue";
+        final String remaining = "testTopicOrQueue";
+        final String fullyQualifiedNamespace = "namespace.servicebus.windows.net";
+        final TokenCredential credential = new DefaultAzureCredentialBuilder().build();
+        final Map<String, Object> params = new HashMap<>();
+        params.put("serviceBusType", ServiceBusType.topic);
+        params.put("prefetchCount", 10);
+        params.put("fullyQualifiedNamespace", fullyQualifiedNamespace);
+        params.put("credentialType", CredentialType.AZURE_IDENTITY);
+
+        final ServiceBusEndpoint endpoint
+                = (ServiceBusEndpoint) context.getComponent("azure-servicebus", ServiceBusComponent.class)
+                        .createEndpoint(uri, remaining, params);
+
+        assertEquals(ServiceBusType.topic, endpoint.getConfiguration().getServiceBusType());
+        assertEquals("testTopicOrQueue", endpoint.getConfiguration().getTopicOrQueueName());
+        assertEquals(10, endpoint.getConfiguration().getPrefetchCount());
+        assertEquals(fullyQualifiedNamespace, endpoint.getConfiguration().getFullyQualifiedNamespace());
+        assertNull(endpoint.getConfiguration().getTokenCredential());
+    }
 }


(camel) 01/04: CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0b59aa0d6fc0e3a89560a385e6a3af31b1e9eec2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 14 14:23:34 2023 +0100

    CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Servicebus
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../camel/catalog/components/azure-servicebus.json | 10 +++---
 .../servicebus/ServiceBusComponentConfigurer.java  |  6 ++++
 .../servicebus/ServiceBusEndpointConfigurer.java   |  6 ++++
 .../servicebus/ServiceBusEndpointUriFactory.java   |  3 +-
 .../azure/servicebus/azure-servicebus.json         | 10 +++---
 .../component/azure/servicebus/CredentialType.java | 39 ++++++++++++++++++++++
 .../azure/servicebus/ServiceBusConfiguration.java  | 17 ++++++++++
 .../servicebus/client/ServiceBusClientFactory.java | 14 +++++---
 8 files changed, 92 insertions(+), 13 deletions(-)

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 2aada61f68d..aaac99c154c 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
@@ -46,8 +46,9 @@
     "serviceBusTransactionContext": { "index": 21, "kind": "property", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents  [...]
     "autowiredEnabled": { "index": 22, "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": 23, "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  [...]
-    "fullyQualifiedNamespace": { "index": 24, "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": 25, "kind": "property", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
+    "credentialType": { "index": 24, "kind": "property", "displayName": "Credential Type", "group": "security", "label": "security", "required": false, "type": "object", "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.ServiceBusConfi [...]
+    "fullyQualifiedNamespace": { "index": 25, "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": 26, "kind": "property", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
   },
   "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 [...]
@@ -102,7 +103,8 @@
     "serviceBusTransactionContext": { "index": 22, "kind": "parameter", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents [...]
     "lazyStartProducer": { "index": 23, "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": 24, "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 [...]
-    "fullyQualifiedNamespace": { "index": 25, "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": 26, "kind": "parameter", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
+    "credentialType": { "index": 25, "kind": "parameter", "displayName": "Credential Type", "group": "security", "label": "security", "required": false, "type": "object", "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.ServiceBusConf [...]
+    "fullyQualifiedNamespace": { "index": 26, "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": 27, "kind": "parameter", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
   }
 }
diff --git a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusComponentConfigurer.java b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusComponentConfigurer.java
index b5d53b7e034..1a46e268be3 100644
--- a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusComponentConfigurer.java
+++ b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusComponentConfigurer.java
@@ -44,6 +44,8 @@ public class ServiceBusComponentConfigurer extends PropertyConfigurerSupport imp
         case "connectionString": getOrCreateConfiguration(target).setConnectionString(property(camelContext, java.lang.String.class, value)); return true;
         case "consumeroperation":
         case "consumerOperation": getOrCreateConfiguration(target).setConsumerOperation(property(camelContext, org.apache.camel.component.azure.servicebus.ServiceBusConsumerOperationDefinition.class, value)); return true;
+        case "credentialtype":
+        case "credentialType": getOrCreateConfiguration(target).setCredentialType(property(camelContext, org.apache.camel.component.azure.servicebus.CredentialType.class, value)); return true;
         case "disableautocomplete":
         case "disableAutoComplete": getOrCreateConfiguration(target).setDisableAutoComplete(property(camelContext, boolean.class, value)); return true;
         case "fullyqualifiednamespace":
@@ -106,6 +108,8 @@ public class ServiceBusComponentConfigurer extends PropertyConfigurerSupport imp
         case "connectionString": return java.lang.String.class;
         case "consumeroperation":
         case "consumerOperation": return org.apache.camel.component.azure.servicebus.ServiceBusConsumerOperationDefinition.class;
+        case "credentialtype":
+        case "credentialType": return org.apache.camel.component.azure.servicebus.CredentialType.class;
         case "disableautocomplete":
         case "disableAutoComplete": return boolean.class;
         case "fullyqualifiednamespace":
@@ -164,6 +168,8 @@ public class ServiceBusComponentConfigurer extends PropertyConfigurerSupport imp
         case "connectionString": return getOrCreateConfiguration(target).getConnectionString();
         case "consumeroperation":
         case "consumerOperation": return getOrCreateConfiguration(target).getConsumerOperation();
+        case "credentialtype":
+        case "credentialType": return getOrCreateConfiguration(target).getCredentialType();
         case "disableautocomplete":
         case "disableAutoComplete": return getOrCreateConfiguration(target).isDisableAutoComplete();
         case "fullyqualifiednamespace":
diff --git a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointConfigurer.java b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointConfigurer.java
index 347cd7fca2b..cc0f831106b 100644
--- a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointConfigurer.java
+++ b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointConfigurer.java
@@ -34,6 +34,8 @@ public class ServiceBusEndpointConfigurer extends PropertyConfigurerSupport impl
         case "connectionString": target.getConfiguration().setConnectionString(property(camelContext, java.lang.String.class, value)); return true;
         case "consumeroperation":
         case "consumerOperation": target.getConfiguration().setConsumerOperation(property(camelContext, org.apache.camel.component.azure.servicebus.ServiceBusConsumerOperationDefinition.class, value)); return true;
+        case "credentialtype":
+        case "credentialType": target.getConfiguration().setCredentialType(property(camelContext, org.apache.camel.component.azure.servicebus.CredentialType.class, value)); return true;
         case "disableautocomplete":
         case "disableAutoComplete": target.getConfiguration().setDisableAutoComplete(property(camelContext, boolean.class, value)); return true;
         case "exceptionhandler":
@@ -97,6 +99,8 @@ public class ServiceBusEndpointConfigurer extends PropertyConfigurerSupport impl
         case "connectionString": return java.lang.String.class;
         case "consumeroperation":
         case "consumerOperation": return org.apache.camel.component.azure.servicebus.ServiceBusConsumerOperationDefinition.class;
+        case "credentialtype":
+        case "credentialType": return org.apache.camel.component.azure.servicebus.CredentialType.class;
         case "disableautocomplete":
         case "disableAutoComplete": return boolean.class;
         case "exceptionhandler":
@@ -156,6 +160,8 @@ public class ServiceBusEndpointConfigurer extends PropertyConfigurerSupport impl
         case "connectionString": return target.getConfiguration().getConnectionString();
         case "consumeroperation":
         case "consumerOperation": return target.getConfiguration().getConsumerOperation();
+        case "credentialtype":
+        case "credentialType": return target.getConfiguration().getCredentialType();
         case "disableautocomplete":
         case "disableAutoComplete": return target.getConfiguration().isDisableAutoComplete();
         case "exceptionhandler":
diff --git a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointUriFactory.java b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointUriFactory.java
index 44df4303677..d9c5ae7807b 100644
--- a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointUriFactory.java
+++ b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointUriFactory.java
@@ -21,7 +21,7 @@ public class ServiceBusEndpointUriFactory extends org.apache.camel.support.compo
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(27);
+        Set<String> props = new HashSet<>(28);
         props.add("amqpRetryOptions");
         props.add("amqpTransportType");
         props.add("binary");
@@ -29,6 +29,7 @@ public class ServiceBusEndpointUriFactory extends org.apache.camel.support.compo
         props.add("clientOptions");
         props.add("connectionString");
         props.add("consumerOperation");
+        props.add("credentialType");
         props.add("disableAutoComplete");
         props.add("exceptionHandler");
         props.add("exchangePattern");
diff --git a/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json b/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json
index 2aada61f68d..aaac99c154c 100644
--- a/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json
+++ b/components/camel-azure/camel-azure-servicebus/src/generated/resources/org/apache/camel/component/azure/servicebus/azure-servicebus.json
@@ -46,8 +46,9 @@
     "serviceBusTransactionContext": { "index": 21, "kind": "property", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents  [...]
     "autowiredEnabled": { "index": 22, "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": 23, "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  [...]
-    "fullyQualifiedNamespace": { "index": 24, "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": 25, "kind": "property", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
+    "credentialType": { "index": 24, "kind": "property", "displayName": "Credential Type", "group": "security", "label": "security", "required": false, "type": "object", "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.ServiceBusConfi [...]
+    "fullyQualifiedNamespace": { "index": 25, "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": 26, "kind": "property", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
   },
   "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 [...]
@@ -102,7 +103,8 @@
     "serviceBusTransactionContext": { "index": 22, "kind": "parameter", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents [...]
     "lazyStartProducer": { "index": 23, "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": 24, "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 [...]
-    "fullyQualifiedNamespace": { "index": 25, "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": 26, "kind": "parameter", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
+    "credentialType": { "index": 25, "kind": "parameter", "displayName": "Credential Type", "group": "security", "label": "security", "required": false, "type": "object", "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.ServiceBusConf [...]
+    "fullyQualifiedNamespace": { "index": 26, "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": 27, "kind": "parameter", "displayName": "Token Credential", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "com.azure.core.credential.TokenCredential", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "A TokenCredential for Azure AD authentication." }
   }
 }
diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/CredentialType.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/CredentialType.java
new file mode 100644
index 00000000000..7a0cd4a6899
--- /dev/null
+++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/CredentialType.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+public enum CredentialType {
+    /**
+     * Servicebus Connection String
+     */
+    CONNECTION_STRING,
+    /**
+     * Includes:
+     * <uL>
+     * <li>Service principal with secret</li>
+     * <li>Service principal with certificate</li>
+     * <li>username and password</li>
+     * </uL>
+     *
+     * @see com.azure.identity.DefaultAzureCredentialBuilder
+     */
+    AZURE_IDENTITY,
+    /**
+     * Servicebus Token Credential
+     */
+    TOKEN_CREDENTIAL,
+}
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 80193afb301..ad77caeec0e 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
@@ -35,6 +35,8 @@ import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import org.apache.camel.spi.UriPath;
 
+import static org.apache.camel.component.azure.servicebus.CredentialType.CONNECTION_STRING;
+
 @UriParams
 public class ServiceBusConfiguration implements Cloneable {
 
@@ -87,6 +89,9 @@ public class ServiceBusConfiguration implements Cloneable {
     private OffsetDateTime scheduledEnqueueTime;
     @UriParam(label = "producer", defaultValue = "false")
     private boolean binary;
+    @UriParam(label = "security", enums = "AZURE_IDENTITY,CONNECTION_STRING,TOKEN_CREDENTIAL",
+            defaultValue = "CONNECTION_STRING")
+    private CredentialType credentialType = CONNECTION_STRING;
 
     /**
      * Selected topic name or the queue name, that is depending on serviceBusType config. For example if
@@ -353,6 +358,18 @@ public class ServiceBusConfiguration implements Cloneable {
         this.binary = binary;
     }
 
+
+    public CredentialType getCredentialType() {
+        return credentialType;
+    }
+
+    /**
+     * Determines the credential strategy to adopt
+     */
+    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 0e2e1161b26..225f61da1c0 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
@@ -17,9 +17,11 @@
 package org.apache.camel.component.azure.servicebus.client;
 
 import com.azure.core.credential.TokenCredential;
+import com.azure.identity.DefaultAzureCredentialBuilder;
 import com.azure.messaging.servicebus.ServiceBusClientBuilder;
 import com.azure.messaging.servicebus.ServiceBusReceiverAsyncClient;
 import com.azure.messaging.servicebus.ServiceBusSenderAsyncClient;
+import org.apache.camel.component.azure.servicebus.CredentialType;
 import org.apache.camel.component.azure.servicebus.ServiceBusConfiguration;
 import org.apache.camel.component.azure.servicebus.ServiceBusType;
 import org.apache.camel.util.ObjectHelper;
@@ -55,11 +57,15 @@ public final class ServiceBusClientFactory {
         String fullyQualifiedNamespace = configuration.getFullyQualifiedNamespace();
         TokenCredential credential = configuration.getTokenCredential();
 
-        // If the FQNS and credential are available, use those to connect
-        if (ObjectHelper.isNotEmpty(fullyQualifiedNamespace) && ObjectHelper.isNotEmpty(credential)) {
-            builder.credential(fullyQualifiedNamespace, credential);
-        } else {
+        if (configuration.getCredentialType().equals(CredentialType.CONNECTION_STRING)) {
             builder.connectionString(configuration.getConnectionString());
+        } else if (configuration.getCredentialType().equals(CredentialType.TOKEN_CREDENTIAL)) {
+            // If the FQNS and credential are available, use those to connect
+            if (ObjectHelper.isNotEmpty(fullyQualifiedNamespace) && ObjectHelper.isNotEmpty(credential)) {
+                builder.credential(fullyQualifiedNamespace, credential);
+            }
+        } else {
+            builder.credential(new DefaultAzureCredentialBuilder().build());
         }
         return builder;
     }