From a3789691b1d5946525883ac2ec9f2358c00972bf Mon Sep 17 00:00:00 2001 From: "dixue@microsoft.com" Date: Tue, 18 Aug 2020 12:57:59 +0800 Subject: [PATCH] Load and merge all public cloud environments --- .../Accounts/Account/ConnectAzureRmAccount.cs | 11 ++++++- src/Accounts/Accounts/ChangeLog.md | 1 + tools/Common.Netcore.Dependencies.targets | 32 +++++++++---------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs b/src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs index d01f76d50010..345dfe327997 100644 --- a/src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs +++ b/src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs @@ -50,7 +50,7 @@ public class ConnectAzureRmAccountCommand : AzureContextModificationCmdlet, IMod public const int DefaultMaxContextPopulation = 25; public const string DefaultMaxContextPopulationString = "25"; - private IAzureEnvironment _environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud]; + private IAzureEnvironment _environment; [Parameter(Mandatory = false, HelpMessage = "Name of the environment containing the account to log into")] [Alias("EnvironmentName")] @@ -188,6 +188,15 @@ protected override IAzureContext DefaultContext protected override void BeginProcessing() { base.BeginProcessing(); + if (AzureEnvironment.PublicEnvironments.ContainsKey(EnvironmentName.AzureCloud)) + { + _environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud]; + } + else + { + WriteWarning($"Default environment {EnvironmentName.AzureCloud} cannot be found from PublicEnvironment list. "); + WriteWarning("You can get current list via [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureEnvironment]::PublicEnvironments"); + } if (MyInvocation.BoundParameters.ContainsKey(nameof(Environment))) { var profile = GetDefaultProfile(); diff --git a/src/Accounts/Accounts/ChangeLog.md b/src/Accounts/Accounts/ChangeLog.md index 04cc065ff0df..d3f20d294e64 100644 --- a/src/Accounts/Accounts/ChangeLog.md +++ b/src/Accounts/Accounts/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Loaded all public cloud environments when discovery endpoint doesn't return default AzureCloud or other public environments [#12633] * Exposed SubscriptionPolicies in `Get-AzSubscription` [#12551] ## Version 1.9.2 diff --git a/tools/Common.Netcore.Dependencies.targets b/tools/Common.Netcore.Dependencies.targets index c43418ec61df..58d4ad26b80d 100644 --- a/tools/Common.Netcore.Dependencies.targets +++ b/tools/Common.Netcore.Dependencies.targets @@ -3,21 +3,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -32,7 +32,7 @@ - $(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.21-preview\tools\ + $(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.22-preview\tools\