public static CloudBlobContainer GetContainer(CloudStorageAccount storageAccount, string containerName) { try { return(BackupRestoreUtility.PerformWithRetries <string, CloudBlobContainer>( (string name) => { CloudBlobContainer container = GetContainerRef(storageAccount, name); // Create the container if (!container.Exists()) { throw new ArgumentException(string.Format("Given container {0} doesn't exist.", name), "containerName"); } return container; }, containerName, new RetriableOperationExceptionHandler(AzureStorageExceptionHandler), RetryCount)); } catch (Exception e) { TraceSource.WriteExceptionAsError( TraceType, e, "Failed to get container {0} from Azure storage.", containerName); throw; } }