Azure / Azure/azurestack-powershell

[Az.Bootstrapper] Install-AzProfile fails to resolve 'azureprofile.azureedge.net'

Abierto
#171 5 comentarios 0 reacciones 1 asignado Reclamado por @TheOnlyWei Ver en GitHub
Lenguaje dominante
PowerShell
Estrellas
16
Forks
37
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Similar to @bganapa's https://github.com/Azure/azurestack-powershell/issues/170

![Image](https://github.com/user-attachments/assets/6c7101b9-200a-49e2-aa30-49a95bc91a21)

```Install-AzProfile -Profile 2020-09-01-hybrid -Force```
```powershell
Install-AzProfile -Profile 2020-09-01-hybrid -Force
Invoke-CommandWithRetry : The remote name could not be resolved: 'azureprofile.azureedge.net'
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:94 char:18
+ $WebResponse = Invoke-CommandWithRetry -ScriptBlock $ScriptBlock
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-CommandWithRetry], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Invoke-CommandWithRetry

Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:108 char:3
+ $OnlineProfileMapETag = $WebResponse.Headers["ETag"]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null. At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:162 char:38 + $OnlineProfileMap = $WebResponse | ConvertFrom-Json + ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFromJsonCommand Get-Member : You must specify an object for the Get-Member cmdlet. At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:808 char:33
+ ... llProfiles = ($ProfileMap | Get-Member -MemberType NoteProperty).Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-Member], InvalidOperationException
+ FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

New-Object : A constructor was not found. Cannot find an appropriate constructor for type System.Management.Automation.ValidateSetAttribute.
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:814 char:31
+ ... Attribute = New-Object -Type System.Management.Automation.ValidateSet ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand

Invoke-CommandWithRetry : The remote name could not be resolved: 'azureprofile.azureedge.net'
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:94 char:18
+ $WebResponse = Invoke-CommandWithRetry -ScriptBlock $ScriptBlock
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-CommandWithRetry], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Invoke-CommandWithRetry

Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:108 char:3
+ $OnlineProfileMapETag = $WebResponse.Headers["ETag"]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:162 char:38
+ $OnlineProfileMap = $WebResponse | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

Get-Member : You must specify an object for the Get-Member cmdlet.
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:808 char:33
+ ... llProfiles = ($ProfileMap | Get-Member -MemberType NoteProperty).Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-Member], InvalidOperationException
+ FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

New-Object : A constructor was not found. Cannot find an appropriate constructor for type System.Management.Automation.ValidateSetAttribute.
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:814 char:31
+ ... Attribute = New-Object -Type System.Management.Automation.ValidateSet ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand

Install-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'.
At C:\Program Files\WindowsPowerShell\Modules\Az.BootStrapper\1.0.1\Az.Bootstrapper.psm1:568 char:104
+ ... sion -AllowClobber -Repository $script:BootStrapRepo -AllowPrerelease
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Install-Module], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Install-Module

```

![Image](https://github.com/user-attachments/assets/118b9f61-5aff-45f1-b672-f53f873ee2b4)

This breaks Azure Stack Hub installation of modules as per https://learn.microsoft.com/en-us/azure-stack/operator/powershell-install-az-module?view=azs-2501#connected-install-with-internet-connectivity

Also breaks getting the module versions:
```Get-AzModule -Profile "2020-09-01-hybrid" -Module "Az.Storage"```

```powershell
$VerbosePreference = "continue"
PS C:\Users\cblack> Get-AzModule -Profile "2020-09-01-hybrid" -Module "Az.Storage"
VERBOSE: Updating profiles
VERBOSE: Requested HTTP/1.1 GET with 0-byte payload
VERBOSE: Waiting 3 second(s) before attempting again
VERBOSE: Requested HTTP/1.1 GET with 0-byte payload
VERBOSE: Waiting 3 second(s) before attempting again
VERBOSE: Requested HTTP/1.1 GET with 0-byte payload
Invoke-CommandWithRetry: No such host is known.
InvalidOperation: Cannot index into a null array.
ConvertFrom-Json: Cannot bind argument to parameter 'InputObject' because it is null.
Get-Member: You must specify an object for the Get-Member cmdlet.
New-Object: A constructor was not found. Cannot find an appropriate constructor for type System.Management.Automation.ValidateSetAttribute.
VERBOSE: Getting the version of Az.Storage from 2020-09-01-hybrid
VERBOSE: Populating RepositorySourceLocation property for module Az.Storage.
2.6.2
```

![Image](https://github.com/user-attachments/assets/767d4f57-19d2-4de1-8cb4-1dd47f341cae)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.