Skip to content

Commit

Permalink
check if output container asset exists or not, if not, create it
Browse files Browse the repository at this point in the history
  • Loading branch information
pohhsu committed Jun 26, 2023
1 parent 7c0de6b commit 2f49ea0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions azure/AzureStorageUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public async Task UploadAsync(
"Uploading to {fileName} in container {container} of account: {account}...",
fileName, containerName, _blobServiceClient.AccountName);
var container = _blobServiceClient.GetBlobContainerClient(containerName);
await container.CreateIfNotExistsAsync(cancellationToken: cancellationToken);
var outputBlob = container.GetBlockBlobClient(fileName);
var options = new BlobUploadOptions
{
Expand All @@ -63,6 +64,7 @@ public async Task UploadBlobAsync(
CancellationToken cancellationToken)
{
var container = _blobServiceClient.GetBlobContainerClient(containerName);
await container.CreateIfNotExistsAsync(cancellationToken: cancellationToken);
var outputBlob = container.GetBlockBlobClient(fileName);
var operation = await outputBlob.StartCopyFromUriAsync(blob.Uri, cancellationToken: cancellationToken);
await operation.WaitForCompletionAsync(cancellationToken);
Expand Down

0 comments on commit 2f49ea0

Please sign in to comment.