Skip to content

Commit e407413

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into dev
2 parents 515392b + 3745478 commit e407413

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Common/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class NewAzureStorageContext : AzureDataCmdlet
7373
/// </summary>
7474
private const string AnonymousEnvironmentParameterSet = "AnonymousAccountEnvironment";
7575

76-
private const string StorageAccountNameHelpMessage = "Azure Storage Acccount Name";
76+
private const string StorageAccountNameHelpMessage = "Azure Storage Account Name";
7777
[Parameter(Position = 0, HelpMessage = StorageAccountNameHelpMessage,
7878
Mandatory = true, ParameterSetName = AccountNameKeyParameterSet)]
7979
[Parameter(Position = 0, HelpMessage = StorageAccountNameHelpMessage,
@@ -283,7 +283,7 @@ internal CloudStorageAccount GetAnonymousStorageAccountFromAzureEnvironment(stri
283283
/// <summary>
284284
/// Get storage account and use specific end point
285285
/// </summary>
286-
/// <param name="credential">Storage credentail</param>
286+
/// <param name="credential">Storage credential</param>
287287
/// <param name="storageAccountName">Storage account name, it's used for build end point</param>
288288
/// <param name="useHttps"></param>
289289
/// <param name="endPoint"></param>
@@ -350,6 +350,19 @@ internal CloudStorageAccount GetStorageAccountWithAzureEnvironment(StorageCreden
350350
}
351351
}
352352

353+
if(null == azureEnvironment)
354+
{
355+
try
356+
{
357+
var profileClient = new ProfileClient(new AzureSMProfile());
358+
azureEnvironment = profileClient.GetEnvironmentOrDefault(azureEnvironmentName);
359+
}
360+
catch(ArgumentException e)
361+
{
362+
throw new ArgumentException(e.Message + " " + string.Format(CultureInfo.CurrentCulture, Resources.ValidEnvironmentName, EnvironmentName.AzureCloud, EnvironmentName.AzureChinaCloud));
363+
}
364+
}
365+
353366
}
354367

355368
if (null != azureEnvironment)

0 commit comments

Comments
 (0)