Skip to content

Set-AzEnvironment -SshAuthScope <string> Errors out for "built-in or discovered environments" #28209

@anwarnuma

Description

@anwarnuma

Description

The following commit was added to support adding SshAuthScope to clouds that did not have urls hardcoded in the repo: c690c21

Unfortunate for clouds that are 'discovered or built-in' but do not have the SshAuthScope there is no way to add it due to the following line. We are currently encountering the error Cannot change built-in or discovered environment when we try to run the Set-AzEnvironment -Name <EnvName> -SshAuthScope <url> :

if (AzureEnvironment.PublicEnvironments.Keys.Any((k) => string.Equals(k, Name, StringComparison.CurrentCultureIgnoreCase)))
{
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
"Cannot change built-in or discovered environment {0}.", Name));
}

And when running the Enter-AzVM -ResourceGroupName <Rg-name> -Name <VM-name> command we get:
Failed to generate AAD Certificate with exception: The scope of authenticating for SSH is not set. Please run "Set-AzEnvironment -Name <EnvName> -SshAuthScope ..." to set it first

Issue script & Debug output

N/A

Environment data

PSVersion    7.5.1
PSEdition    Core
GitCommitId  7.5.1
Platform     Win32NT
PSCompatibleVersion {1.0, 2.0, 3.0, 4.0...}

Module versions

Az.Accounts 5.1.1
Az.Compute  9.0.0
Az.Ssh      0.2.3

Error output

Message: Failed to generate AAD Certificate with exception: The scope of authenticating for SSH is not set. Please run "Set-AzEnvironment -Name <EnvName> -SshAuthScope ..." to set it first ...

Exception: Microsoft.Azure.Commands.Common.Exception.AzPSApplicationException
InvocationInfo: {Enter-AzVM}

Metadata

Metadata

Assignees

Labels

AccountsIssues in Az.Accounts except authentication relatedTrackingWe will track status and follow internallybugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions