// <summary>
        /// This method creates a Polly retry policy when there is blob exception with code Unauthorized.
        /// </summary>
        /// <returns>The AsyncRetryPolicy</returns>
        private AsyncRetryPolicy GetBlobRetryPolicy()
        {
            return(Policy.Handle <RequestFailedException>(e => (e.Status == (int)HttpStatusCode.Unauthorized || e.Status == (int)HttpStatusCode.Forbidden))
                   .RetryAsync(1, async(exception, retryCount) =>
            {
                try
                {
                    await semaphoreSlim.WaitAsync().ConfigureAwait(false);
                    logger.LogInformation("Read the blob connection from KeyVault.");

                    // Get the latest blob connection key.
                    var blobConnectionSecret = await keyVaultClient.GetSecretAsync(configuration["KeyVaultUrl"], Constants.BlobConnection).ConfigureAwait(false);


                    logger.LogInformation("Refresh blob storage connection with upadated secret.");
                    blobStorageService.RefreshBlobServiceClient(blobConnectionSecret.Value);
                }
                finally
                {
                    // release the semaphore
                    semaphoreSlim.Release();
                }
            }));
        }