Skip to content

Commit ddaf855

Browse files
authored
Load and merge all public cloud environments (#12688)
Merge this change because of macos out of time.
1 parent 8c41bbd commit ddaf855

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class ConnectAzureRmAccountCommand : AzureContextModificationCmdlet, IMod
5050
public const int DefaultMaxContextPopulation = 25;
5151
public const string DefaultMaxContextPopulationString = "25";
5252

53-
private IAzureEnvironment _environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud];
53+
private IAzureEnvironment _environment;
5454

5555
[Parameter(Mandatory = false, HelpMessage = "Name of the environment containing the account to log into")]
5656
[Alias("EnvironmentName")]
@@ -188,6 +188,15 @@ protected override IAzureContext DefaultContext
188188
protected override void BeginProcessing()
189189
{
190190
base.BeginProcessing();
191+
if (AzureEnvironment.PublicEnvironments.ContainsKey(EnvironmentName.AzureCloud))
192+
{
193+
_environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud];
194+
}
195+
else
196+
{
197+
WriteWarning($"Default environment {EnvironmentName.AzureCloud} cannot be found from PublicEnvironment list. ");
198+
WriteWarning("You can get current list via [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureEnvironment]::PublicEnvironments");
199+
}
191200
if (MyInvocation.BoundParameters.ContainsKey(nameof(Environment)))
192201
{
193202
var profile = GetDefaultProfile();

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Loaded all public cloud environments when discovery endpoint doesn't return default AzureCloud or other public environments [#12633]
2122
* Exposed SubscriptionPolicies in `Get-AzSubscription` [#12551]
2223

2324
## Version 1.9.2

tools/Common.Netcore.Dependencies.targets

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
<ItemGroup>
44
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.20"/>
55
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19"/>
6-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.3.21-preview"/>
7-
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.3.21-preview"/>
8-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.3.21-preview"/>
9-
<PackageReference Include="Microsoft.Azure.PowerShell.Common" Version="1.3.21-preview"/>
10-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Compute" Version="1.3.21-preview"/>
11-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Graph.Rbac" Version="1.3.21-preview"/>
12-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.KeyVault" Version="1.3.21-preview"/>
13-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Monitor" Version="1.3.21-preview"/>
14-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Network" Version="1.3.21-preview"/>
15-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.PolicyInsights" Version="1.3.21-preview"/>
16-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.ResourceManager" Version="1.3.21-preview"/>
17-
<PackageReference Include="Microsoft.Azure.PowerShell.Storage" Version="1.3.21-preview"/>
18-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Storage.Management" Version="1.3.21-preview"/>
19-
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.3.21-preview"/>
20-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.3.21-preview"/>
6+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.3.22-preview"/>
7+
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.3.22-preview"/>
8+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.3.22-preview"/>
9+
<PackageReference Include="Microsoft.Azure.PowerShell.Common" Version="1.3.22-preview"/>
10+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Compute" Version="1.3.22-preview"/>
11+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Graph.Rbac" Version="1.3.22-preview"/>
12+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.KeyVault" Version="1.3.22-preview"/>
13+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Monitor" Version="1.3.22-preview"/>
14+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Network" Version="1.3.22-preview"/>
15+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.PolicyInsights" Version="1.3.22-preview"/>
16+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.ResourceManager" Version="1.3.22-preview"/>
17+
<PackageReference Include="Microsoft.Azure.PowerShell.Storage" Version="1.3.22-preview"/>
18+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Storage.Management" Version="1.3.22-preview"/>
19+
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.3.22-preview"/>
20+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.3.22-preview"/>
2121
</ItemGroup>
2222
<ItemGroup Condition="'$(IsTestProject)' != 'true'">
2323
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.4.0">
@@ -32,7 +32,7 @@
3232
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0" PrivateAssets="All" />
3333
</ItemGroup>
3434
<PropertyGroup>
35-
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.21-preview\tools\</StorageToolsPath>
35+
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.22-preview\tools\</StorageToolsPath>
3636
</PropertyGroup>
3737
<ItemGroup Condition="'$(OmitJsonPackage)' != 'true'">
3838
<PackageReference Include="Newtonsoft.Json" Version="10.0.3"/>

0 commit comments

Comments
 (0)