PowerShell: preserve structured ARM failure details in `ErrorRecord`
Los mantenedores suelen responder en 1 día
@VeryEarly ya está trabajando en esto.
Desde el 22/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Summary
In the Az 0.1.4 preview bundle, Get-AzResourceGroup reports an ARM 404 through a generic System.Exception, with category NotSpecified and no populated ErrorDetails or TargetObject.
The HTTP status and ARM error code survive in the message text, but callers must parse that text to distinguish service failures reliably.
Reproduction
Using an authenticated profile and a resource-group name that does not exist:
try {
Get-AzResourceGroup `
-SubscriptionId '<subscription-id>' `
-Name 'azclips-ro-check-does-not-exist' `
-ErrorAction Stop
} catch {
[pscustomobject]@{
ExceptionType = $_.Exception.GetType().FullName
ErrorId = $_.FullyQualifiedErrorId
Category = $_.CategoryInfo.Category
ErrorDetails = $_.ErrorDetails
TargetObject = $_.TargetObject
Message = $_.Exception.Message
} | Format-List
}
Observed result
| Field | Observed value |
|---|---|
| Exception type | System.Exception |
| Error ID | ResourceGroupError,Microsoft.Azure.Azclips.Cmdlets.Resources.GetResourceGroupCmdlet |
| Category | NotSpecified |
| ErrorDetails | Null |
| TargetObject | Null |
| Message | HTTP 404, request URL, and embedded ARM JSON containing ResourceGroupNotFound |
-ErrorAction Stop and catch work. The concern is the information available inside the caught record, not whether the error is catchable.
As a control, an unknown cmdlet parameter retains a native ParameterBindingException, category InvalidArgument, and the specific NamedParameterNotFound error ID.
Relevant implementation
The released CmdletOutputStreamsFactory constructs an ErrorRecord using:
new Exception(value?.ToString() ?? string.Empty)
and a null target. This matches the observed generic exception and missing target.
Suggested improvement
Preserve the service failure information in a documented, programmatically accessible form:
- HTTP status and ARM error code.
- A meaningful error category—for example,
ObjectNotFoundfor this case. - The requested resource as
TargetObject. - An underlying exception or structured payload that retains useful service details.
Keep the human-readable message and existing -ErrorAction behavior. The goal is to let scripts handle a missing resource without matching strings inside a message.
Environment and scope
- Release:
v0.1.4.20260930T053744Z - Az rollup 0.1.4; Az.Resources 0.1.2
- PowerShell 7.6.4 on Debian 13
- Read-only request; no resources created or modified
- One ARM 404 case tested; other service-error categories were not tested
- Lenguaje dominante
- C#
- Estrellas
- 18
- Forks
- 10
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 157
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Azure/azclips
-
act-identity-squad bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
act-identity-squad bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
act-identity-squad bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
act-identity-squad bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Azure/azclips#1512 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Agent] Interactive recovery runs shell commands in the install folder, not the user's folderAbiertoact-experience-enablement-squad bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de Azure/azclips
Issues similares
-
launcher item missingAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Realm667/WolfenDoom#1758 ·
-
SDK version compatibility issueAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
-
AI documentation good first issue help wanted
Dificultad 1/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
akshit-bansal11/edgepad#106 ·
Los mantenedores suelen responder en 1 día