1

In the Microsoft.WindowsAzure.Storage (the legacy Azure SDK for .NET), we could set the retry policy for a BlobClient to be an IRetryPolicy like so:

var blobClient = this.storageAccount.CreateCloudBlobClient();    
blobClient.DefaultRequestOptions.RetryPolicy = TransientFactory.GetStorageRetryPolicy().AsAzureStorageClientRetryPolicy();

However, in the new version of the SDK, with BlobClients being directly created without having to go through a CloudStorageAccount, how can we do this?

The furthest I have been able to get using the docs is to manually set max retries:

 var blobClientOptions = new BlobClientOptions();
 blobClientOptions.Retry.MaxRetries = 4;
 var blobServiceClient = new BlobServiceClient("connection_string", options: blobClientOptions);
        

Instead of manually setting retry parameters, is it possible set the RetryPolicy on a BlobClient or BlobServiceClient?

0

1 Answer 1

1

The usage you post is exactly the way we use. We could set the retry policy in two positions.

One is how you post: set the retry policy when creating blob client.

One set the retry policy when creating BlobServiceClient:

var blobServiceClient = new BlobServiceClient
(connectionString:storageAccountConnectionString, options: blobClientOptions);

Follow here.

2
  • Is it possible to set an IRetryPolicy though anywhere in the new SDK? Commented May 26, 2021 at 14:13
  • It seems not possible.
    – Doris Lv
    Commented May 27, 2021 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.