I am implementing an Android app where I need to upload images to a blob container using a container SAS.
Currently using the full endpoint credentials as a connection string, I can add a retry policy to my CloudBlobClient
using the following code:
CloudStorageAccount storageAccount = CloudStorageAccount
.parse(storageConnectionString);
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
BlobRequestOptions options = new BlobRequestOptions();
RetryPolicy policy = new RetryExponentialRetry(BACKOFF_DELTA, MAX_RETRIES);
options.setRetryPolicyFactory(policy);
blobClient.setDefaultRequestOptions(options);
CloudBlobContainer container = blobClient.getContainerReference(containername);
Now, as I am switching from the account key to SAS, I don't know how to create a CloudBlobClient
using the SAS signature I have for my container. I can create both CloudBlobClient
and CloudBlobContainer
using the URL with SAS, but the client is created with anonymous credentials and cannot be associated with my container:
CloudBlobClient blobClient = new CloudBlobClient(URI.create(containerurl));
CloudBlobContainer container = new CloudBlobContainer(URI.create(containerurl));
Is there a way to add RetryPolicy
directly to the CloudBlobContainer
or create an authenticated CloudBlobClient
associated with my container class?
This was tagged with both 'Java' and 'Android', so I'll reply about the Java SDK, Android should be similar.
There are a few options here:
Hope this helps!