Skip to content

Connect-AzAccount does not correctly set the name of the environment #28995

@faix

Description

@faix

Description

I have some additional environments like for example:

$azEnv = (Get-AzEnvironment -Name AzureCloud)
$azEnv.Name = "$"
$azEnv.ResourceManagerUrl = "https://centraluseuap.management.azure.com/"
$azEnv | Add-AzEnvironment

If i start with no context and do Connect-AzAccount -Environment CentralUsEuap

Image

Its all good. But then i do Connect-AzAccount -Environment AzureCloud

Image

And the resource manager url has changed, yet the name of the environment has remained the same...

The inverse is also true, i can start with AzureCloud and then swap, and the Name will stay as AzureCloud instead of swapping to CentralUSEuap

Issue script & Debug output

N/A

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.20348.4294
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.4294
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.3.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear...
Script     6.4.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateConta...
Script     7.22.0     Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Add-Az...
Script     8.1.1      Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDeny...

Error output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedneeds-triageThis is a new issue that needs to be triaged to the appropriate team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions