abhishekagarwal87 commented on a change in pull request #12266:
URL: https://github.com/apache/druid/pull/12266#discussion_r809290265



##########
File path: 
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureStorageDruidModule.java
##########
@@ -125,17 +129,36 @@ public void configure(Binder binder)
   @LazySingleton
   public Supplier<CloudBlobClient> getCloudBlobClient(final AzureAccountConfig 
config)
   {
+    if ((config.getKey() != null && config.getSharedAccessStorageToken() != 
null)
+        ||
+        (config.getKey() == null && config.getSharedAccessStorageToken() == 
null)) {
+      throw new ISE("Either set 'key' or 'sharedAccessStorageToken' in the 
azure config but not both");
+    }
     return Suppliers.memoize(() -> {
       try {
-        CloudStorageAccount account = CloudStorageAccount.parse(
-            StringUtils.format(
-                STORAGE_CONNECTION_STRING,
-                config.getProtocol(),
-                config.getAccount(),
-                config.getKey()
-            )
-        );
-        return account.createCloudBlobClient();
+        final CloudStorageAccount account;
+        if (config.getKey() != null) {
+          account = CloudStorageAccount.parse(
+              StringUtils.format(
+                  STORAGE_CONNECTION_STRING_WITH_KEY,
+                  config.getProtocol(),
+                  config.getAccount(),
+                  config.getKey()
+              )
+
+          );
+          return account.createCloudBlobClient();
+        } else if (config.getSharedAccessStorageToken() != null) {
+          account = CloudStorageAccount.parse(StringUtils.format(
+              STORAGE_CONNECTION_STRING_WITH_TOKEN,
+              config.getProtocol(),
+              config.getAccount(),
+              config.getSharedAccessStorageToken()
+          ));
+          return account.createCloudBlobClient();
+        } else {
+          throw new ISE("Either set 'key' or 'sharedAccessStorageToken' in the 
azure config but not both");

Review comment:
       ```suggestion
             throw new ISE("None of 'key' or 'sharedAccessStorageToken' is set 
in the azure config.  Please refer to azure extension documentation.");
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to