@@ -78,7 +78,7 @@ private string GetBase64Encoding(object obj)
78
78
/// <param name="taskId"></param>
79
79
/// <param name="storageCredentialsFactory"></param>
80
80
/// <returns></returns>
81
- public List < CloudPageBlob > FindSnapshot ( List < string > blobUris , List < StorageCredentialsFactory > storageCredentialsFactory , Dictionary < string , string > snapshotQuery )
81
+ public List < CloudPageBlob > FindSnapshot ( AzureContext azContext , List < string > blobUris , List < StorageCredentialsFactory > storageCredentialsFactory , Dictionary < string , string > snapshotQuery )
82
82
{
83
83
List < CloudPageBlob > snapshots = new List < CloudPageBlob > ( ) ;
84
84
for ( int i = 0 ; i < blobUris . Count ; i ++ )
@@ -87,7 +87,7 @@ public List<CloudPageBlob> FindSnapshot(List<string> blobUris, List<StorageCrede
87
87
if ( BlobUri . TryParseUri ( new Uri ( blobUris [ i ] ) , out blobUri ) )
88
88
{
89
89
StorageCredentials sc = storageCredentialsFactory [ i ] . Create ( blobUri ) ;
90
- CloudStorageAccount cloudStorageAccount = new CloudStorageAccount ( sc , true ) ;
90
+ CloudStorageAccount cloudStorageAccount = new CloudStorageAccount ( sc , azContext . Environment . GetEndpointSuffix ( AzureEnvironment . Endpoint . StorageEndpointSuffix ) , true ) ;
91
91
CloudBlobClient blobClient = cloudStorageAccount . CreateCloudBlobClient ( ) ;
92
92
CloudBlobContainer blobContainer = blobClient . GetContainerReference ( blobUri . BlobContainerName ) ;
93
93
IEnumerable < IListBlobItem > blobs = blobContainer . ListBlobs ( null , true , BlobListingDetails . All ) ;
@@ -197,7 +197,7 @@ public void RemoveSnapshot(AzureVMBackupConfig vmConfig, string snapshotTag, Vir
197
197
198
198
Dictionary < string , string > snapshotQuery = new Dictionary < string , string > ( ) ;
199
199
snapshotQuery . Add ( backupExtensionMetadataName , snapshotTag ) ;
200
- List < CloudPageBlob > snapshots = this . FindSnapshot ( blobSASUris . pageBlobUri , blobSASUris . storageCredentialsFactory , snapshotQuery ) ;
200
+ List < CloudPageBlob > snapshots = this . FindSnapshot ( virtualMachineExtensionBaseCmdlet . DefaultProfile . Context , blobSASUris . pageBlobUri , blobSASUris . storageCredentialsFactory , snapshotQuery ) ;
201
201
if ( snapshots == null || snapshots . Count == 0 )
202
202
{
203
203
throw new AzureVMBackupException ( AzureVMBackupErrorCodes . NoSnapshotFound , "snapshot with the tag not found." ) ;
@@ -284,7 +284,7 @@ public void CreateSnapshotForDisks(AzureVMBackupConfig vmConfig, string snapshot
284
284
int i = 0 ;
285
285
for ( ; i < loopingTimes ; i ++ )
286
286
{
287
- List < CloudPageBlob > snapshotsFound = this . FindSnapshot ( blobSASUris . pageBlobUri , blobSASUris . storageCredentialsFactory , snapshotQuery ) ;
287
+ List < CloudPageBlob > snapshotsFound = this . FindSnapshot ( virtualMachineExtensionBaseCmdlet . DefaultProfile . Context , blobSASUris . pageBlobUri , blobSASUris . storageCredentialsFactory , snapshotQuery ) ;
288
288
if ( snapshotsFound . Count == vmPageBlobUris . Count )
289
289
{
290
290
break ;
0 commit comments