Azure / Azure/azure-powershell

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

Open
#28,209 8 comments 0 reactions 1 assignee Claimed by @isra-fel View on GitHub
Accounts bug customer-reported Tracking
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

The following commit was added to support adding SshAuthScope to clouds that did not have urls hardcoded in the repo: https://github.com/Azure/azure-powershell/commit/c690c21c318798d4686e70caee1cf22df3acaf4f

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 -SshAuthScope ` :

https://github.com/Azure/azure-powershell/blob/dd5c97b8ed62bda422fa0d7d6a644ca79763ee6b/src/Accounts/Accounts/Environment/SetAzureRMEnvironment.cs#L214-L218

And when running the `Enter-AzVM -ResourceGroupName -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 -SshAuthScope ..." to set it first`

### Issue script & Debug output

```PowerShell
N/A
```

### Environment data

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

### Module versions

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

### Error output

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

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.