Skip to content

Commit fd0ffa0

Browse files
author
Kamran Khan
committed
Pass endpoint suddix when creating CloudStorageAccount
1 parent dab2653 commit fd0ffa0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private string GetBase64Encoding(object obj)
7878
/// <param name="taskId"></param>
7979
/// <param name="storageCredentialsFactory"></param>
8080
/// <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)
8282
{
8383
List<CloudPageBlob> snapshots = new List<CloudPageBlob>();
8484
for (int i = 0; i < blobUris.Count; i++)
@@ -87,7 +87,7 @@ public List<CloudPageBlob> FindSnapshot(List<string> blobUris, List<StorageCrede
8787
if (BlobUri.TryParseUri(new Uri(blobUris[i]), out blobUri))
8888
{
8989
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);
9191
CloudBlobClient blobClient = cloudStorageAccount.CreateCloudBlobClient();
9292
CloudBlobContainer blobContainer = blobClient.GetContainerReference(blobUri.BlobContainerName);
9393
IEnumerable<IListBlobItem> blobs = blobContainer.ListBlobs(null, true, BlobListingDetails.All);
@@ -197,7 +197,7 @@ public void RemoveSnapshot(AzureVMBackupConfig vmConfig, string snapshotTag, Vir
197197

198198
Dictionary<string, string> snapshotQuery = new Dictionary<string, string>();
199199
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);
201201
if (snapshots == null || snapshots.Count == 0)
202202
{
203203
throw new AzureVMBackupException(AzureVMBackupErrorCodes.NoSnapshotFound, "snapshot with the tag not found.");
@@ -284,7 +284,7 @@ public void CreateSnapshotForDisks(AzureVMBackupConfig vmConfig, string snapshot
284284
int i = 0;
285285
for (; i < loopingTimes; i++)
286286
{
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);
288288
if (snapshotsFound.Count == vmPageBlobUris.Count)
289289
{
290290
break;

0 commit comments

Comments
 (0)