File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 18
18
- Additional information about change #1
19
19
-->
20
20
## Upcoming Release
21
+ * Fixed copy blob fail with source context as Oauth [ #14662 ]
22
+ - ` Start-AzStorageBlobCopy `
21
23
22
24
## Version 3.5.0
23
25
* Fixed an issue that list account from resource group won't use nextlink
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ internal static Uri GenerateUriWithCredentials(
197
197
private static string GetBlobSasToken ( CloudBlob blob )
198
198
{
199
199
if ( null == blob . ServiceClient . Credentials
200
- || blob . ServiceClient . Credentials . IsAnonymous )
200
+ || ( blob . ServiceClient . Credentials . IsAnonymous && ! blob . ServiceClient . Credentials . IsToken ) )
201
201
{
202
202
return string . Empty ;
203
203
}
@@ -225,8 +225,18 @@ private static string GetBlobSasToken(CloudBlob blob)
225
225
{
226
226
rootBlob = Util . GetBlobReference ( blob . Uri , blob . ServiceClient . Credentials , blob . BlobType ) ;
227
227
}
228
+ if ( ! blob . ServiceClient . Credentials . IsToken ) // not oauth, generated normal sas
229
+ {
230
+ return rootBlob . GetSharedAccessSignature ( policy ) ;
231
+ }
232
+ else // oauth, generate identity sas
233
+ {
234
+ DateTimeOffset userDelegationKeyStartTime = DateTime . Now ;
235
+ DateTimeOffset userDelegationKeyEndTime = userDelegationKeyStartTime . AddMinutes ( CopySASLifeTimeInMinutes ) ;
236
+ Azure . Storage . UserDelegationKey userDelegationKey = rootBlob . ServiceClient . GetUserDelegationKey ( userDelegationKeyStartTime , userDelegationKeyEndTime ) ;
228
237
229
- return rootBlob . GetSharedAccessSignature ( policy ) ;
238
+ return rootBlob . GetUserDelegationSharedAccessSignature ( userDelegationKey , policy ) ;
239
+ }
230
240
}
231
241
232
242
private static string GetBlobSasToken ( BlobBaseClient blob , AzureStorageContext context )
You can’t perform that action at this time.
0 commit comments