Skip to content

Commit 9336bc7

Browse files
committed
fix after blob test
1 parent dfad632 commit 9336bc7

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/Storage/Storage/Blob/Cmdlet/GetAzureStorageBlobCopyState.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ protected bool IsTaskCompleted(long taskId)
113113
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
114114
public override void ExecuteCmdlet()
115115
{
116+
if (Channel.IsSasWithOAuthCredential())
117+
{
118+
throw new InvalidOperationException("Get Blob Async copy status doesn't support user delegation SAS with OAuth credential.");
119+
}
120+
116121
CloudBlob blob = null;
117122

118123
switch (ParameterSetName)

src/Storage/Storage/Blob/Cmdlet/RemoveAzureStorageBlob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ internal async Task RemoveAzureBlob(long taskId, IStorageBlobManagement localCha
344344

345345
ValidatePipelineCloudBlobContainer(container);
346346

347-
if (!UseTrack2Sdk())
347+
if (!UseTrack2Sdk() && !Channel.IsSasWithOAuthCredential())
348348
{
349349
AccessCondition accessCondition = null;
350350
BlobRequestOptions requestOptions = null;

src/Storage/Storage/Blob/Cmdlet/StopAzureStorageBlobCopy.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ protected override void BeginProcessing()
105105
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
106106
public override void ExecuteCmdlet()
107107
{
108+
if (Channel.IsSasWithOAuthCredential())
109+
{
110+
throw new InvalidOperationException("Stop Blob Async copy doesn't support user delegation SAS with OAuth credential.");
111+
}
108112
Func<long, Task> taskGenerator = null;
109113
IStorageBlobManagement localChannel = Channel;
110114
string target = string.Empty;
@@ -186,7 +190,7 @@ private async Task StopCopyBlob(long taskId, IStorageBlobManagement localChannel
186190
{
187191
ValidateBlobType(blob);
188192

189-
if (UseTrack2Sdk()) // Use Track2
193+
if (UseTrack2Sdk() || Channel.IsSasWithOAuthCredential()) // Use Track2
190194
{
191195
if (null == blob)
192196
{

src/Storage/Storage/Common/AzureStorageBlob.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ private void SetProperties(BlobBaseClient track2BlobClient, AzureStorageContext
408408
public static CloudBlob GetTrack1Blob(BlobBaseClient track2BlobClient, StorageCredentials credentials, global::Azure.Storage.Blobs.Models.BlobType? blobType = null)
409409
{
410410
if ((Util.GetVersionIdFromBlobUri(track2BlobClient.Uri) != null)
411-
|| (track2BlobClient.Uri.Query.Contains("sig=") && (credentials == null || !credentials.IsSAS)))
411+
|| (track2BlobClient.Uri.Query.Contains("sig=") && (credentials == null || !credentials.IsSAS))
412+
|| track2BlobClient.Uri.Query.Contains("sduoid=")) // UD sas + bearer token
412413
{
413414
// Track1 SDK don't support blob VersionId
414415
return new InvalidCloudBlob(track2BlobClient.Uri, credentials);
@@ -452,7 +453,7 @@ public static BlobClient GetTrack2BlobClient(CloudBlob cloubBlob, AzureStorageCo
452453
{
453454
BlobClient blobClient;
454455
if (cloubBlob.ServiceClient.Credentials.IsToken
455-
|| (context != null && context.Track2OauthToken != null)) //Oauth
456+
|| (context != null && context.Track2OauthToken != null && !cloubBlob.ServiceClient.Credentials.IsSAS && !cloubBlob.ServiceClient.Credentials.IsSharedKey)) //Oauth
456457
{
457458
if (context == null)
458459
{

0 commit comments

Comments
 (0)