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

[camel] branch main updated: CAMEL-18099: Adding Azure Identity authentication support (#7615)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new c7f41de9451 CAMEL-18099: Adding Azure Identity authentication support (#7615)
c7f41de9451 is described below

commit c7f41de94519eb2e4419eec5c24a4c28eb79c8ed
Author: Hugo Veillette <hu...@gmail.com>
AuthorDate: Tue May 17 22:14:09 2022 -0700

    CAMEL-18099: Adding Azure Identity authentication support (#7615)
    
    * CAMEL-18099: Adding Azure Identity authentication support to the AzureBlob component.
    
    * CAMEL-18099: Adding Azure Identity authentication support to the AzureBlob component.
    - organized imports.
    
    * CAMEL-18099: Adding Azure Identity authentication support to the AzureBlob component.
    - organized imports for checkstyle import order.
    
    * CAMEL-18111: Adding support for private endpoints and custom DNS
    PR Review, fixing * imports to fully qualified.
    
    * CAMEL-18111: Adding support for private endpoints and custom DNS
    PR Review, Java convention for Enums
    
    * CAMEL-18111: Adding support for private endpoints and custom DNS
    PR Review, Java convention for Enums
    
    * CAMEL-18111: Adding support for private endpoints and custom DNS
    PR Review, Java convention for Enums (missed ref in doc)
    
    * CAMEL-18099: Adding Azure Identity authentication support #7615
    - Ran mvm formatter:format
    - Fixed tests to specify CredentialType
    - Fixed regression in clientFactory
    
    Co-authored-by: Hugo Veillette <hu...@ia.ca>
---
 .../camel-azure/camel-azure-storage-blob/pom.xml   |  6 +++-
 .../storage/blob/BlobComponentConfigurer.java      |  6 ++++
 .../azure/storage/blob/BlobEndpointConfigurer.java |  6 ++++
 .../azure/storage/blob/BlobEndpointUriFactory.java |  3 +-
 .../azure/storage/blob/azure-storage-blob.json     |  6 ++--
 .../main/docs/azure-storage-blob-component.adoc    | 26 ++++++--------
 .../azure/storage/blob/BlobComponent.java          | 34 ++++++++++--------
 .../azure/storage/blob/BlobConfiguration.java      | 20 +++++++++--
 .../azure/storage/blob/CredentialType.java         | 41 ++++++++++++++++++++++
 .../storage/blob/client/BlobClientFactory.java     | 40 ++++++++++++---------
 .../azure/storage/blob/BlobComponentTest.java      | 13 ++++---
 .../azure/storage/blob/integration/Base.java       |  3 ++
 .../blob/integration/BlobCopyProducerIt.java       |  2 +-
 13 files changed, 149 insertions(+), 57 deletions(-)

diff --git a/components/camel-azure/camel-azure-storage-blob/pom.xml b/components/camel-azure/camel-azure-storage-blob/pom.xml
index 23b1b28c5f6..b6adf733008 100644
--- a/components/camel-azure/camel-azure-storage-blob/pom.xml
+++ b/components/camel-azure/camel-azure-storage-blob/pom.xml
@@ -52,7 +52,11 @@
             <artifactId>azure-storage-blob-changefeed</artifactId>
             <version>${azure-storage-blob-changefeed-version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>com.azure</groupId>
+            <artifactId>azure-identity</artifactId>
+            <version>${azure-identity-version}</version>
+        </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
diff --git a/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobComponentConfigurer.java b/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobComponentConfigurer.java
index a98ba429951..15b752c4a66 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobComponentConfigurer.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobComponentConfigurer.java
@@ -61,6 +61,8 @@ public class BlobComponentConfigurer extends PropertyConfigurerSupport implement
         case "createAppendBlob": getOrCreateConfiguration(target).setCreateAppendBlob(property(camelContext, boolean.class, value)); return true;
         case "createpageblob":
         case "createPageBlob": getOrCreateConfiguration(target).setCreatePageBlob(property(camelContext, boolean.class, value)); return true;
+        case "credentialtype":
+        case "credentialType": getOrCreateConfiguration(target).setCredentialType(property(camelContext, org.apache.camel.component.azure.storage.blob.CredentialType.class, value)); return true;
         case "credentials": getOrCreateConfiguration(target).setCredentials(property(camelContext, com.azure.storage.common.StorageSharedKeyCredential.class, value)); return true;
         case "datacount":
         case "dataCount": getOrCreateConfiguration(target).setDataCount(property(camelContext, java.lang.Long.class, value)); return true;
@@ -129,6 +131,8 @@ public class BlobComponentConfigurer extends PropertyConfigurerSupport implement
         case "createAppendBlob": return boolean.class;
         case "createpageblob":
         case "createPageBlob": return boolean.class;
+        case "credentialtype":
+        case "credentialType": return org.apache.camel.component.azure.storage.blob.CredentialType.class;
         case "credentials": return com.azure.storage.common.StorageSharedKeyCredential.class;
         case "datacount":
         case "dataCount": return java.lang.Long.class;
@@ -193,6 +197,8 @@ public class BlobComponentConfigurer extends PropertyConfigurerSupport implement
         case "createAppendBlob": return getOrCreateConfiguration(target).isCreateAppendBlob();
         case "createpageblob":
         case "createPageBlob": return getOrCreateConfiguration(target).isCreatePageBlob();
+        case "credentialtype":
+        case "credentialType": return getOrCreateConfiguration(target).getCredentialType();
         case "credentials": return getOrCreateConfiguration(target).getCredentials();
         case "datacount":
         case "dataCount": return getOrCreateConfiguration(target).getDataCount();
diff --git a/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointConfigurer.java b/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointConfigurer.java
index 18bfc3f99c1..c40a3d36a14 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointConfigurer.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointConfigurer.java
@@ -59,6 +59,8 @@ public class BlobEndpointConfigurer extends PropertyConfigurerSupport implements
         case "createAppendBlob": target.getConfiguration().setCreateAppendBlob(property(camelContext, boolean.class, value)); return true;
         case "createpageblob":
         case "createPageBlob": target.getConfiguration().setCreatePageBlob(property(camelContext, boolean.class, value)); return true;
+        case "credentialtype":
+        case "credentialType": target.getConfiguration().setCredentialType(property(camelContext, org.apache.camel.component.azure.storage.blob.CredentialType.class, value)); return true;
         case "credentials": target.getConfiguration().setCredentials(property(camelContext, com.azure.storage.common.StorageSharedKeyCredential.class, value)); return true;
         case "datacount":
         case "dataCount": target.getConfiguration().setDataCount(property(camelContext, java.lang.Long.class, value)); return true;
@@ -159,6 +161,8 @@ public class BlobEndpointConfigurer extends PropertyConfigurerSupport implements
         case "createAppendBlob": return boolean.class;
         case "createpageblob":
         case "createPageBlob": return boolean.class;
+        case "credentialtype":
+        case "credentialType": return org.apache.camel.component.azure.storage.blob.CredentialType.class;
         case "credentials": return com.azure.storage.common.StorageSharedKeyCredential.class;
         case "datacount":
         case "dataCount": return java.lang.Long.class;
@@ -255,6 +259,8 @@ public class BlobEndpointConfigurer extends PropertyConfigurerSupport implements
         case "createAppendBlob": return target.getConfiguration().isCreateAppendBlob();
         case "createpageblob":
         case "createPageBlob": return target.getConfiguration().isCreatePageBlob();
+        case "credentialtype":
+        case "credentialType": return target.getConfiguration().getCredentialType();
         case "credentials": return target.getConfiguration().getCredentials();
         case "datacount":
         case "dataCount": return target.getConfiguration().getDataCount();
diff --git a/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointUriFactory.java b/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointUriFactory.java
index 5396475b427..8ebec7f1a6f 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointUriFactory.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/generated/java/org/apache/camel/component/azure/storage/blob/BlobEndpointUriFactory.java
@@ -21,7 +21,7 @@ public class BlobEndpointUriFactory extends org.apache.camel.support.component.E
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(50);
+        Set<String> props = new HashSet<>(51);
         props.add("accessKey");
         props.add("accountName");
         props.add("backoffErrorThreshold");
@@ -43,6 +43,7 @@ public class BlobEndpointUriFactory extends org.apache.camel.support.component.E
         props.add("containerName");
         props.add("createAppendBlob");
         props.add("createPageBlob");
+        props.add("credentialType");
         props.add("credentials");
         props.add("dataCount");
         props.add("delay");
diff --git a/components/camel-azure/camel-azure-storage-blob/src/generated/resources/org/apache/camel/component/azure/storage/blob/azure-storage-blob.json b/components/camel-azure/camel-azure-storage-blob/src/generated/resources/org/apache/camel/component/azure/storage/blob/azure-storage-blob.json
index 02c92f1874a..0859860610c 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/generated/resources/org/apache/camel/component/azure/storage/blob/azure-storage-blob.json
+++ b/components/camel-azure/camel-azure-storage-blob/src/generated/resources/org/apache/camel/component/azure/storage/blob/azure-storage-blob.json
@@ -22,12 +22,13 @@
     "lenientProperties": false
   },
   "componentProperties": {
-    "blobName": { "kind": "property", "displayName": "Blob Name", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "The blob name, to consume specific blob from a container. However on producer, is only required for the operations on [...]
+    "blobName": { "kind": "property", "displayName": "Blob Name", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "The blob name, to consume specific blob from a container. However, on producer it is only required for the operations [...]
     "blobOffset": { "kind": "property", "displayName": "Blob Offset", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "Set the blob offset for the upload or download operations, default is 0" },
     "blobType": { "kind": "property", "displayName": "Blob Type", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.storage.blob.BlobType", "enum": [ "blockblob", "appendblob", "pageblob" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "blockblob", "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description":  [...]
     "closeStreamAfterRead": { "kind": "property", "displayName": "Close Stream After Read", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "Close the stream after read or keep it open, default is true" },
     "configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configurations" },
     "credentials": { "kind": "property", "displayName": "Credentials", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.azure.storage.common.StorageSharedKeyCredential", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "StorageSharedKeyCredential can be injected to create the azure client, this holds t [...]
+    "credentialType": { "kind": "property", "displayName": "Credential Type", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.storage.blob.CredentialType", "enum": [ "SHARED_ACCOUNT_KEY", "SHARED_KEY_CREDENTIAL", "AZURE_IDENTITY" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "AZURE_IDENTITY", "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "conf [...]
     "dataCount": { "kind": "property", "displayName": "Data Count", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "How many bytes to include in the range. Must be greater than or equal to 0 if specified." },
     "fileDir": { "kind": "property", "displayName": "File Dir", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "The file directory where the downloaded blobs will be saved to, this can be used in both, producer and consumer" },
     "maxResultsPerPage": { "kind": "property", "displayName": "Max Results Per Page", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the requ [...]
@@ -121,12 +122,13 @@
   "properties": {
     "accountName": { "kind": "path", "displayName": "Account Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "Azure account name to be used for authentication with azure blob services" },
     "containerName": { "kind": "path", "displayName": "Container Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "The blob container name" },
-    "blobName": { "kind": "parameter", "displayName": "Blob Name", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "The blob name, to consume specific blob from a container. However on producer, is only required for the operations o [...]
+    "blobName": { "kind": "parameter", "displayName": "Blob Name", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "The blob name, to consume specific blob from a container. However, on producer it is only required for the operation [...]
     "blobOffset": { "kind": "parameter", "displayName": "Blob Offset", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "Set the blob offset for the upload or download operations, default is 0" },
     "blobServiceClient": { "kind": "parameter", "displayName": "Blob Service Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.azure.storage.blob.BlobServiceClient", "deprecated": false, "autowired": false, "secret": false, "description": "Client to a storage account. This client does not hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests to the resource on the service. It may  [...]
     "blobType": { "kind": "parameter", "displayName": "Blob Type", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.storage.blob.BlobType", "enum": [ "blockblob", "appendblob", "pageblob" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "blockblob", "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": [...]
     "closeStreamAfterRead": { "kind": "parameter", "displayName": "Close Stream After Read", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "Close the stream after read or keep it open, default is true" },
     "credentials": { "kind": "parameter", "displayName": "Credentials", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.azure.storage.common.StorageSharedKeyCredential", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "StorageSharedKeyCredential can be injected to create the azure client, this holds  [...]
+    "credentialType": { "kind": "parameter", "displayName": "Credential Type", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.storage.blob.CredentialType", "enum": [ "SHARED_ACCOUNT_KEY", "SHARED_KEY_CREDENTIAL", "AZURE_IDENTITY" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "AZURE_IDENTITY", "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "con [...]
     "dataCount": { "kind": "parameter", "displayName": "Data Count", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "How many bytes to include in the range. Must be greater than or equal to 0 if specified." },
     "fileDir": { "kind": "parameter", "displayName": "File Dir", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "The file directory where the downloaded blobs will be saved to, this can be used in both, producer and consumer" },
     "maxResultsPerPage": { "kind": "parameter", "displayName": "Max Results Per Page", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.storage.blob.BlobConfiguration", "configurationField": "configuration", "description": "Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the req [...]
diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/docs/azure-storage-blob-component.adoc b/components/camel-azure/camel-azure-storage-blob/src/main/docs/azure-storage-blob-component.adoc
index 269551cd64e..dd68f23f7bf 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/main/docs/azure-storage-blob-component.adoc
+++ b/components/camel-azure/camel-azure-storage-blob/src/main/docs/azure-storage-blob-component.adoc
@@ -66,17 +66,13 @@ include::partial$component-endpoint-options.adoc[]
 
 *Required information options:*
 
-To use this component, you have 3 options in order to provide the required Azure authentication information:
-
-- Provide `accountName` and `accessKey` for your Azure account, this is the simplest way to get started. The accessKey can
-be generated through your Azure portal.
-- Provide a https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/staging/apidocs/com/azure/storage/common/StorageSharedKeyCredential.html[StorageSharedKeyCredential] instance which can be
-provided into `credentials` option.
-- Provide a https://azuresdkdocs.blob.core.windows.net/$web/java/azure-storage-blob/12.0.0/com/azure/storage/blob/BlobServiceClient.html[BlobServiceClient] instance which can be
-provided into `blobServiceClient`. Note: You don't need to create a specific client, e.g: BlockBlobClient, the BlobServiceClient represents the upper level which
-can be used to retrieve lower level clients.
-
+To use this component, you have multiple options in order to provide the required Azure authentication information:
 
+- By providing your own https://azuresdkdocs.blob.core.windows.net/$web/java/azure-storage-blob/12.0.0/com/azure/storage/blob/BlobServiceClient.html[BlobServiceClient] instance which can be injected into `blobServiceClient`. Note: You don't need to create a specific client, e.g: BlockBlobClient, the BlobServiceClient represents the upper level which
+can be used to retrieve lower level clients.
+- Via Azure Identity, when specifying `credentialType=AZURE_IDENTITY` and providing required https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#environment-variables[environment variables]. This enables service principal (e.g. app registration) authentication with secret/certificate as well as username password. Note that this is the default authentication strategy.
+- Via shared storage account key, when specifying `credentialType=SHARED_ACCOUNT_KEY` and providing `accountName` and `accessKey` for your Azure account, this is the simplest way to get started. The accessKey can be generated through your Azure portal.
+- Via shared storage account key, when specifying `credentialType=SHARED_KEY_CREDENTIAL` and providing a https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/staging/apidocs/com/azure/storage/common/StorageSharedKeyCredential.html[StorageSharedKeyCredential] instance which can be injected into `credentials` option.
 
 == Usage
 
@@ -85,7 +81,7 @@ located on the `container1` in the `camelazure` storage account, use the followi
 
 [source,java]
 --------------------------------------------------------------------------------
-from("azure-storage-blob://camelazure/container1?blobName=hello.txt&accessKey=yourAccessKey").
+from("azure-storage-blob://camelazure/container1?blobName=hello.txt&credentialType=SHARED_ACCOUNT_KEY&accessKey=RAW(yourAccessKey)").
 to("file://blobdirectory");
 --------------------------------------------------------------------------------
 
@@ -164,9 +160,9 @@ For these operations, `accountName`, `containerName` and `blobName` are *require
 |`uploadBlockBlob` |BlockBlob|Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with PutBlob; the content of the existing blob is overwritten with the new content.
 |`stageBlockBlobList`|`BlockBlob`|Uploads the specified block to the block blob's "staging area" to be later committed by a call to commitBlobBlockList. However in case header `CamelAzureStorageBlobCommitBlobBlockListLater` or config `commitBlockListLater` is set to false, this will commit the blocks immediately after staging the blocks.
 |`commitBlobBlockList`|`BlockBlob`|Writes a blob by specifying the list of block IDs that are to make up the blob. In order to be written as part
-                                    of a blob, a block must have been successfully written to the server in a prior `stageBlockBlobList` operation. You can
-                                    call `commitBlobBlockList` to update a blob by uploading only those blocks that have changed, then committing the new
-                                    and existing blocks together. Any blocks not specified in the block list and permanently deleted.
+of a blob, a block must have been successfully written to the server in a prior `stageBlockBlobList` operation. You can
+call `commitBlobBlockList` to update a blob by uploading only those blocks that have changed, then committing the new
+and existing blocks together. Any blocks not specified in the block list and permanently deleted.
 |`getBlobBlockList`  |`BlockBlob`|Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter.
 |`createAppendBlob` |`AppendBlob`|Creates a 0-length append blob. Call commitAppendBlo`b operation to append data to an append blob.
 |`commitAppendBlob` |`AppendBlob`|Commits a new block of data to the end of the existing append blob. In case of header `CamelAzureStorageBlobCreateAppendBlob` or config `createAppendBlob` is set to true, it will attempt to create the appendBlob through internal call to `createAppendBlob` operation first before committing.
@@ -548,7 +544,7 @@ To run the integration tests, on this component directory, run the following mav
 
 [source,bash]
 ----
-mvn verify -PfullTests -DaccountName=myacc -DaccessKey=mykey
+mvn verify -PfullTests -DaccountName=myacc -DaccessKey=mykey -DcredentialType=SHARED_ACCOUNT_KEY
 ----
 
 Whereby `accountName` is your Azure account name and `accessKey` is the access key being generated from Azure portal.
diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java
index 0d850d862b5..32eb29fdd81 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java
@@ -27,6 +27,10 @@ import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
 
+import static org.apache.camel.component.azure.storage.blob.CredentialType.AZURE_IDENTITY;
+import static org.apache.camel.component.azure.storage.blob.CredentialType.SHARED_ACCOUNT_KEY;
+import static org.apache.camel.component.azure.storage.blob.CredentialType.SHARED_KEY_CREDENTIAL;
+
 /**
  * Azure Blob Storage component using azure java sdk v12.x
  */
@@ -49,9 +53,7 @@ public class BlobComponent extends DefaultComponent {
             throw new IllegalArgumentException("At least the account name must be specified.");
         }
 
-        final BlobConfiguration config = this.configuration != null
-                ? this.configuration.copy()
-                : new BlobConfiguration();
+        final BlobConfiguration config = this.configuration != null ? this.configuration.copy() : new BlobConfiguration();
 
         final String[] parts = remaining.split("/");
 
@@ -66,7 +68,7 @@ public class BlobComponent extends DefaultComponent {
         final BlobEndpoint endpoint = new BlobEndpoint(uri, this, config);
         setProperties(endpoint, parameters);
 
-        checkCredentials(config);
+        initCredentialConfig(config);
         validateConfigurations(config);
 
         return endpoint;
@@ -83,24 +85,28 @@ public class BlobComponent extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkCredentials(final BlobConfiguration configuration) {
+    private void initCredentialConfig(final BlobConfiguration configuration) {
         final BlobServiceClient client = configuration.getServiceClient();
 
-        // if no azureBlobClient is provided fallback to credentials
         if (client == null) {
-            Set<StorageSharedKeyCredential> storageSharedKeyCredentials
-                    = getCamelContext().getRegistry().findByType(StorageSharedKeyCredential.class);
-            if (storageSharedKeyCredentials.size() == 1) {
-                configuration.setCredentials(storageSharedKeyCredentials.stream().findFirst().get());
+            //default to AZURE_AD
+            if (configuration.getCredentialType() == null) {
+                configuration.setCredentialType(AZURE_IDENTITY);
+            } else if (SHARED_KEY_CREDENTIAL.equals(configuration.getCredentialType())) {
+                Set<StorageSharedKeyCredential> storageSharedKeyCredentials
+                        = getCamelContext().getRegistry().findByType(StorageSharedKeyCredential.class);
+                storageSharedKeyCredentials.stream().findFirst().ifPresent(configuration::setCredentials);
             }
         }
     }
 
     private void validateConfigurations(final BlobConfiguration configuration) {
-        if (configuration.getServiceClient() == null
-                && configuration.getAccessKey() == null
-                && configuration.getCredentials() == null) {
-            throw new IllegalArgumentException("Azure Storage accessKey or BlobServiceClient must be specified.");
+        if (configuration.getServiceClient() == null) {
+            if (SHARED_KEY_CREDENTIAL.equals(configuration.getCredentialType()) && configuration.getCredentials() == null) {
+                throw new IllegalArgumentException("When using shared key credential, credentials must be provided.");
+            } else if (SHARED_ACCOUNT_KEY.equals(configuration.getCredentialType()) && configuration.getAccessKey() == null) {
+                throw new IllegalArgumentException("When using shared account key, access key must be provided.");
+            }
         }
     }
 }
diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java
index 7674dbd90ad..eba9ae60cd6 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java
@@ -31,6 +31,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.storage.blob.CredentialType.AZURE_IDENTITY;
+
 @UriParams
 public class BlobConfiguration implements Cloneable {
 
@@ -97,6 +99,9 @@ public class BlobConfiguration implements Cloneable {
     private String regex;
     @UriParam(label = "security", secret = true)
     private String sourceBlobAccessKey;
+    @UriParam(label = "common", enums = "SHARED_ACCOUNT_KEY,SHARED_KEY_CREDENTIAL,AZURE_IDENTITY",
+              defaultValue = "AZURE_IDENTITY")
+    private CredentialType credentialType = AZURE_IDENTITY;
 
     /**
      * Azure account name to be used for authentication with azure blob services
@@ -136,7 +141,7 @@ public class BlobConfiguration implements Cloneable {
      * Client to a storage account. This client does not hold any state about a particular storage account but is
      * instead a convenient way of sending off appropriate requests to the resource on the service. It may also be used
      * to construct URLs to blobs and containers.
-     *
+     * <p>
      * This client contains operations on a service account. Operations on a container are available on
      * {@link BlobContainerClient} through {@link BlobServiceClient#getBlobContainerClient(String)}, and operations on a
      * blob are available on {@link BlobClient} through {@link BlobContainerClient#getBlobClient(String)}.
@@ -172,7 +177,7 @@ public class BlobConfiguration implements Cloneable {
     }
 
     /**
-     * The blob name, to consume specific blob from a container. However on producer, is only required for the
+     * The blob name, to consume specific blob from a container. However, on producer it is only required for the
      * operations on the blob level
      */
     public String getBlobName() {
@@ -429,6 +434,17 @@ public class BlobConfiguration implements Cloneable {
         return sourceBlobAccessKey;
     }
 
+    public CredentialType getCredentialType() {
+        return credentialType;
+    }
+
+    /**
+     * Determines the credential strategy to adopt
+     */
+    public void setCredentialType(CredentialType credentialType) {
+        this.credentialType = credentialType;
+    }
+
     /**
      * Source Blob Access Key: for copyblob operation, sadly, we need to have an accessKey for the source blob we want
      * to copy Passing an accessKey as header, it's unsafe so we could set as key.
diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/CredentialType.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/CredentialType.java
new file mode 100644
index 00000000000..587788d77c5
--- /dev/null
+++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/CredentialType.java
@@ -0,0 +1,41 @@
+/*
+ * 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.storage.blob;
+
+public enum CredentialType {
+    /**
+     * Shared key credential
+     * 
+     * @see com.azure.storage.common.StorageSharedKeyCredential
+     */
+    SHARED_KEY_CREDENTIAL,
+    /**
+     * storage shared account key
+     */
+    SHARED_ACCOUNT_KEY,
+    /**
+     * 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
+}
diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientFactory.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientFactory.java
index 46f71fcbf44..bcfc285216d 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientFactory.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/client/BlobClientFactory.java
@@ -16,13 +16,19 @@
  */
 package org.apache.camel.component.azure.storage.blob.client;
 
-import java.util.Locale;
-
+import com.azure.identity.DefaultAzureCredentialBuilder;
 import com.azure.storage.blob.BlobServiceClient;
 import com.azure.storage.blob.BlobServiceClientBuilder;
 import com.azure.storage.common.StorageSharedKeyCredential;
 import org.apache.camel.component.azure.storage.blob.BlobConfiguration;
-import org.apache.camel.util.ObjectHelper;
+
+import static java.lang.String.format;
+import static java.util.Locale.ROOT;
+import static java.util.Optional.ofNullable;
+import static java.util.Set.of;
+import static org.apache.camel.component.azure.storage.blob.CredentialType.SHARED_ACCOUNT_KEY;
+import static org.apache.camel.component.azure.storage.blob.CredentialType.SHARED_KEY_CREDENTIAL;
+import static org.apache.camel.util.ObjectHelper.isEmpty;
 
 public final class BlobClientFactory {
 
@@ -32,28 +38,28 @@ public final class BlobClientFactory {
     }
 
     public static BlobServiceClient createBlobServiceClient(final BlobConfiguration configuration) {
-        return new BlobServiceClientBuilder()
-                .endpoint(buildAzureEndpointUri(configuration))
-                .credential(getCredentialForClient(configuration))
-                .buildClient();
+        BlobServiceClientBuilder blobServiceClientBuilder
+                = new BlobServiceClientBuilder().endpoint(buildAzureEndpointUri(configuration));
+
+        if (of(SHARED_KEY_CREDENTIAL, SHARED_ACCOUNT_KEY).contains(configuration.getCredentialType())) {
+            blobServiceClientBuilder.credential(getSharedKeyCredential(configuration));
+        } else {
+            blobServiceClientBuilder.credential(new DefaultAzureCredentialBuilder().build());
+        }
+        return blobServiceClientBuilder.buildClient();
     }
 
     private static String buildAzureEndpointUri(final BlobConfiguration configuration) {
-        return String.format(Locale.ROOT, "https://%s" + SERVICE_URI_SEGMENT, getAccountName(configuration));
+        return format(ROOT, "https://%s" + SERVICE_URI_SEGMENT, getAccountName(configuration));
     }
 
-    private static StorageSharedKeyCredential getCredentialForClient(final BlobConfiguration configuration) {
-        final StorageSharedKeyCredential storageSharedKeyCredential = configuration.getCredentials();
-
-        if (storageSharedKeyCredential != null) {
-            return storageSharedKeyCredential;
-        }
-
-        return new StorageSharedKeyCredential(configuration.getAccountName(), configuration.getAccessKey());
+    private static StorageSharedKeyCredential getSharedKeyCredential(final BlobConfiguration configuration) {
+        return ofNullable(configuration.getCredentials())
+                .orElseGet(() -> new StorageSharedKeyCredential(configuration.getAccountName(), configuration.getAccessKey()));
     }
 
     private static String getAccountName(final BlobConfiguration configuration) {
-        return !ObjectHelper.isEmpty(configuration.getCredentials())
+        return !isEmpty(configuration.getCredentials())
                 ? configuration.getCredentials().getAccountName() : configuration.getAccountName();
     }
 
diff --git a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/BlobComponentTest.java b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/BlobComponentTest.java
index 4213278f36e..713d8f430ed 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/BlobComponentTest.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/BlobComponentTest.java
@@ -30,6 +30,7 @@ import org.apache.camel.support.DefaultExchange;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 
+import static org.apache.camel.component.azure.storage.blob.CredentialType.SHARED_KEY_CREDENTIAL;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -43,6 +44,7 @@ class BlobComponentTest extends CamelTestSupport {
     void testCreateEndpointWithMinConfigForClientOnly() {
         final BlobConfiguration configuration = new BlobConfiguration();
         configuration.setCredentials(storageSharedKeyCredential());
+        configuration.setCredentialType(SHARED_KEY_CREDENTIAL);
         final BlobServiceClient serviceClient = BlobClientFactory.createBlobServiceClient(configuration);
 
         context.getRegistry().bind("azureBlobClient", serviceClient);
@@ -58,7 +60,8 @@ class BlobComponentTest extends CamelTestSupport {
         context.getRegistry().bind("creds", storageSharedKeyCredential());
 
         final BlobEndpoint endpoint = (BlobEndpoint) context
-                .getEndpoint("azure-storage-blob://camelazure/container?blobName=blob&credentials=#creds");
+                .getEndpoint(
+                        "azure-storage-blob://camelazure/container?blobName=blob&credentials=#creds&credentialType=SHARED_KEY_CREDENTIAL");
 
         doTestCreateEndpointWithMinConfig(endpoint, false);
     }
@@ -89,7 +92,7 @@ class BlobComponentTest extends CamelTestSupport {
         context.getRegistry().bind("metadata", Collections.emptyMap());
 
         final String uri = "azure-storage-blob://camelazure/container"
-                           + "?blobName=blob&credentials=#creds&blobType=pageblob"
+                           + "?blobName=blob&credentials=#creds&credentialType=SHARED_KEY_CREDENTIAL&blobType=pageblob"
                            + "&fileDir=/tmp&blobOffset=512&operation=clearPageBlob&dataCount=1024"
                            + "&closeStreamAfterRead=false&closeStreamAfterWrite=false";
         final BlobEndpoint endpoint = (BlobEndpoint) context.getEndpoint(uri);
@@ -114,7 +117,7 @@ class BlobComponentTest extends CamelTestSupport {
         context.getRegistry().bind("creds", storageSharedKeyCredential());
 
         BlobEndpoint endpointWithOp = (BlobEndpoint) context.getEndpoint(
-                "azure-storage-blob://camelazure/container?operation=deleteBlob&credentials=#creds");
+                "azure-storage-blob://camelazure/container?operation=deleteBlob&credentials=#creds&credentialType=SHARED_KEY_CREDENTIAL");
 
         Producer producer = endpointWithOp.createProducer();
         DefaultExchange exchange = new DefaultExchange(context);
@@ -127,7 +130,8 @@ class BlobComponentTest extends CamelTestSupport {
         context.getRegistry().bind("creds", storageSharedKeyCredential());
 
         BlobEndpoint endpoint = (BlobEndpoint) context
-                .getEndpoint("azure-storage-blob://camelazure/container?blobName=blob/sub&credentials=#creds");
+                .getEndpoint(
+                        "azure-storage-blob://camelazure/container?blobName=blob/sub&credentials=#creds&credentialType=SHARED_KEY_CREDENTIAL");
         assertEquals("blob/sub", endpoint.getConfiguration().getBlobName());
     }
 
@@ -142,6 +146,7 @@ class BlobComponentTest extends CamelTestSupport {
 
         final String uri = "azure-storage-blob://camelazure"
                            + "?credentials=#creds"
+                           + "&credentialType=SHARED_KEY_CREDENTIAL"
                            + "&operation=getChangeFeed"
                            + "&changeFeedStartTime=#starttime"
                            + "&changeFeedEndTime=#endtime";
diff --git a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java
index 9852a4ec76b..d863f222f31 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java
@@ -31,6 +31,8 @@ import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.TestInstance;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
+import static org.apache.camel.component.azure.storage.blob.CredentialType.SHARED_KEY_CREDENTIAL;
+
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class Base extends CamelTestSupport {
     @RegisterExtension
@@ -75,6 +77,7 @@ public class Base extends CamelTestSupport {
         containerName = RandomStringUtils.randomAlphabetic(5).toLowerCase();
 
         configuration = new BlobConfiguration();
+        configuration.setCredentialType(SHARED_KEY_CREDENTIAL);
         configuration.setCredentials(new StorageSharedKeyCredential(
                 service.azureCredentials().accountName(), service.azureCredentials().accountKey()));
         configuration.setContainerName(containerName);
diff --git a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/BlobCopyProducerIt.java b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/BlobCopyProducerIt.java
index 2c454ed1ed8..766b89a50e1 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/BlobCopyProducerIt.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/BlobCopyProducerIt.java
@@ -47,7 +47,7 @@ class BlobCopyProducerIt extends CamelTestSupport {
             @Override
             public void configure() {
                 from("direct:copyBlob")
-                        .to("azure-storage-blob://testblob214/test215?operation=copyBlob&sourceBlobAccessKey=RAW(sourceAccessKey)&accessKey=(accessKey)");
+                        .to("azure-storage-blob://testblob214/test215?operation=copyBlob&sourceBlobAccessKey=RAW(sourceAccessKey)&credentialType=SHARED_ACCOUNT_KEY&accessKey=(accessKey)");
             }
         };
     }