[ 
https://issues.apache.org/jira/browse/JCLOUDS-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17947855#comment-17947855
 ] 

Xavier BOURGOUIN commented on JCLOUDS-1557:
-------------------------------------------

Many thanks [~gaul]!

In the meanwhile I may have found a way to have it working directly with 
jclouds, forcing to use authType=AzureSharedKey (instead of the default 
SharedKeyLite). 

For anyone interested that somehow lands here, here's a working 
jclouds.properties for Azurite that works with recent jclouds (2.6.2): 

{code:java}
jclouds.provider = azureblob
jclouds.endpoint=http://127.0.0.1:10000/devstoreaccount1
jclouds.identity=devstoreaccount1
jclouds.credential=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
# Force not using SharedKeyLite, at least until it is supported in Azurite - 
See https://github.com/Azure/Azurite/pull/1752
jclouds.azureblob.auth=azureSharedKey
{code}

See: 
- open/unmerged contrib on Azurite to support SharedKeyLite: 
https://github.com/Azure/Azurite/pull/1752
- jclouds contrib that added SharedKey support to workaround the lack of 
support of SharedKeyLite (for that exact purpose): 
https://github.com/apache/jclouds/commit/a2628f9cbf46519f88600883b23e8819b18e3724

[~gaul] I don't know if you think this should be worth updating jclouds Azure 
documentation with it (for example here: 
https://jclouds.apache.org/guides/azure-storage/ under a dedicated section 
"Azurite/ Azure Local storage emulator"), at least this was the first place I 
had been looking for it before going down the rabbit hole on that ...

Thanks!




> Azure Blob Storage: Support for Local Endpoints (eg Azurite)
> ------------------------------------------------------------
>
>                 Key: JCLOUDS-1557
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1557
>             Project: jclouds
>          Issue Type: Improvement
>          Components: jclouds-blobstore
>            Reporter: Dave Sloan
>            Assignee: Andrew Gaul
>            Priority: Major
>              Labels: azureblob
>             Fix For: 2.3.0
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> Azurite provides a local Azure-compatible endpoint for purposes of testing 
> without requiring network traffic or incurring costs on Azure.
> Currently while it is possible to define a custom endpoint this is not 
> respected.
> In both
> [https://github.com/apache/jclouds/blob/ba1504b38e725c45db304767ac76b2be4b71fd0d/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobRequestSigner.java#L66]
> [https://github.com/apache/jclouds/blob/ca5190636a5fc1ffe48d0d6b8087ad160c0b7d80/providers/azureblob/src/main/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthentication.java#L95]
>  
> The `storageUrl` is hard-coded to the Azure location
> {code:java}
> this.storageUrl = URI.create("https://"; + creds.get().identity + 
> ".blob.core.windows.net/");
> {code}
>  
> This should be made to respect a custom endpoint if configured, e.g.
>  
> {code:java}
> BlobStoreContext context = ContextBuilder.newBuilder("azureblob")
>                  .credentials(storageAccountName, storageAccountKey)
>                  .endpoint("http://localhost:10000";)
>                  .buildView(BlobStoreContext.class);
> {code}
> In addition, similar to the AWS S3 connector (`enableVirtualHostBuckets`), a 
> configurable property should be provided to change the format of the URLs 
> used by Azure to include the storage account name in the path.
>  
>  
> *Azure endpoint URL format (storage account in hostname)*
> [https://devstoreaccount1.blob.core.windows.net/]
>  
> *Azurite endpoint URL format (**storage account*  *in path)*
> [http://localhost:10000/devstoreaccount1/]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to