Skip to content

Commit 188e54f

Browse files
committed
fix error in Test-AzureRmVMAEMExtension and improve error message for standard storage
1 parent 43dd149 commit 188e54f

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/AEMHelper.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,21 @@ internal string GetAzureStorageKeyFromCache(string accountName)
291291

292292
internal string GetCoreEndpoint(string storageAccountName)
293293
{
294-
var storage = this.GetStorageAccountFromCache(storageAccountName);
295-
var blobendpoint = storage.PrimaryEndpoints.Blob;
294+
try
295+
{
296+
var storage = this.GetStorageAccountFromCache(storageAccountName);
297+
var blobendpoint = storage.PrimaryEndpoints.Blob;
298+
var blobUri = new Uri(blobendpoint);
296299

297-
var blobMatch = Regex.Match(blobendpoint, ".*?\\.blob\\.(.*)");
298-
if (blobMatch.Success)
300+
var blobMatch = Regex.Match(blobUri.Host, ".*?\\.blob\\.(.*)");
301+
if (blobMatch.Success)
302+
{
303+
return blobMatch.Groups[1].Value;
304+
}
305+
}
306+
catch (Exception ex)
299307
{
300-
return blobMatch.Groups[1].Value;
308+
WriteWarning("Could not extract endpoint information from Azure Storage Account ({0}). Using default {1}", ex.Message, AEMExtensionConstants.AzureEndpoint);
301309
}
302310

303311
WriteWarning("Could not extract endpoint information from Azure Storage Account. Using default {0}", AEMExtensionConstants.AzureEndpoint);

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/SetAzureRmVMAEMExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public override void ExecuteCmdlet()
298298

299299
if (wadstorage == null)
300300
{
301-
this._Helper.WriteError("A Standard Storage Account is required.");
301+
this._Helper.WriteError("A standard storage account is required. Please use parameter WADStorageAccountName to specify a standard storage account you want to use for this VM.");
302302
return;
303303
}
304304

0 commit comments

Comments
 (0)