@@ -626,7 +626,20 @@ private async Task StartCopyFromBlob(long taskId, IStorageBlobManagement destCha
626
626
{
627
627
try
628
628
{
629
- await StartCopyFromUri ( taskId , destChannel , srcBlob . GenerateUriWithCredentials ( ) , destBlob ) . ConfigureAwait ( false ) ;
629
+ Uri srcBlobUriWithCredentail = null ;
630
+ if ( Channel != null && destChannel != null &&
631
+ Channel . StorageContext != null && destChannel . StorageContext != null
632
+ && Channel . StorageContext . StorageAccountName == destChannel . StorageContext . StorageAccountName
633
+ && Channel . StorageContext . StorageAccount . Credentials . IsToken )
634
+ {
635
+ // if inside same account, source blob can be anonumous
636
+ srcBlobUriWithCredentail = srcBlob . SnapshotQualifiedUri ;
637
+ }
638
+ else
639
+ {
640
+ srcBlobUriWithCredentail = srcBlob . GenerateUriWithCredentials ( ) ;
641
+ }
642
+ await StartCopyFromUri ( taskId , destChannel , srcBlobUriWithCredentail , destBlob ) . ConfigureAwait ( false ) ;
630
643
}
631
644
catch ( StorageException ex )
632
645
{
@@ -648,7 +661,20 @@ private async Task StartCopyFromBlob(long taskId, IStorageBlobManagement destCha
648
661
{
649
662
try
650
663
{
651
- await StartCopyFromUri ( taskId , destChannel , srcBlob . GenerateUriWithCredentials ( Channel . StorageContext ) , destBlob ) . ConfigureAwait ( false ) ;
664
+ Uri srcBlobUriWithCredentail = null ;
665
+ if ( Channel != null && destChannel != null &&
666
+ Channel . StorageContext != null && destChannel . StorageContext != null
667
+ && Channel . StorageContext . StorageAccountName == destChannel . StorageContext . StorageAccountName
668
+ && Channel . StorageContext . StorageAccount . Credentials . IsToken )
669
+ {
670
+ // if inside same account, source blob can be anonumous
671
+ srcBlobUriWithCredentail = srcBlob . Uri ;
672
+ }
673
+ else
674
+ {
675
+ srcBlobUriWithCredentail = srcBlob . GenerateUriWithCredentials ( Channel . StorageContext ) ;
676
+ }
677
+ await StartCopyFromUri ( taskId , destChannel , srcBlobUriWithCredentail , destBlob ) . ConfigureAwait ( false ) ;
652
678
}
653
679
catch ( StorageException ex )
654
680
{
0 commit comments