Skip to content

Commit

Permalink
Add missing SAS credential support in Blob and Queue extension
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Jan 20, 2023
1 parent 7b443fd commit a022406
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/CloudStorageAccount/BlobAccountExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using Azure;
using Azure.Storage;
using Azure.Storage.Blobs;

Expand Down Expand Up @@ -33,6 +34,8 @@ public static BlobServiceClient CreateBlobServiceClient(this CloudStorageAccount
new StorageSharedKeyCredential(account.Credentials.AccountName, account.Credentials.AccountKey));
else if (account.Credentials.IsAnonymous)
return new BlobServiceClient(account.BlobEndpoint);
else if (account.Credentials.IsSAS)
return new BlobServiceClient(account.BlobEndpoint, new AzureSasCredential(account.Credentials.Signature!));

throw new InvalidOperationException("Account credentials are not supported for Blob client.");
}
Expand Down
3 changes: 3 additions & 0 deletions src/CloudStorageAccount/QueueAccountExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using Azure;
using Azure.Storage;
using Azure.Storage.Queues;

Expand Down Expand Up @@ -33,6 +34,8 @@ public static QueueServiceClient CreateQueueServiceClient(this CloudStorageAccou
new StorageSharedKeyCredential(account.Credentials.AccountName, account.Credentials.AccountKey));
else if (account.Credentials.IsAnonymous)
return new QueueServiceClient(account.QueueEndpoint);
else if (account.Credentials.IsSAS)
return new QueueServiceClient(account.QueueEndpoint, new AzureSasCredential(account.Credentials.Signature!));

throw new InvalidOperationException("Account credentials are not supported for Queue client.");
}
Expand Down

0 comments on commit a022406

Please sign in to comment.