Resolve-AzError
Mostrar información detallada sobre los errores de PowerShell, con detalles extendidos para los errores de Azure PowerShell.
Sintaxis
Resolve-AzError
[[-Error] <ErrorRecord[]>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Resolve-AzError
[-Last]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Resuelve y muestra información detallada sobre los errores en la sesión actual de PowerShell, incluido dónde se produjo el error en el script, el seguimiento de la pila y todas las excepciones internas y agregadas. En el caso de los errores de Azure PowerShell, se proporcionan detalles adicionales sobre los problemas del servicio de depuración, incluidos detalles completos sobre la solicitud y la respuesta del servidor que provocó el error.
Ejemplos
Ejemplo 1: Resolución del último error
Resolve-AzError -Last
HistoryId: 3
Message : Run Connect-AzAccount to login.
StackTrace : at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.get_DefaultContext() in AzureRmCmdlet.cs:line 85
at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.LogCmdletStartInvocationInfo() in AzureRmCmdlet.cs:line 269
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.BeginProcessing() inAzurePSCmdlet.cs:line 299
at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.BeginProcessing() in AzureRmCmdlet.cs:line 320
at Microsoft.Azure.Commands.Profile.GetAzureRMSubscriptionCommand.BeginProcessing() in GetAzureRMSubscription.cs:line 49
at System.Management.Automation.Cmdlet.DoBeginProcessing()
at System.Management.Automation.CommandProcessorBase.DoBegin()
Exception : System.Management.Automation.PSInvalidOperationException
InvocationInfo : {Get-AzSubscription}
Line : Get-AzSubscription
Position : At line:1 char:1
+ Get-AzSubscription
+ ~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3
Obtenga los detalles del último error.
Ejemplo 2: Resolver todos los errores de la sesión
Resolve-AzError
HistoryId: 8
RequestId : b61309e8-09c9-4f0d-ba56-08a6b28c731d
Message : Resource group 'contoso' could not be found.
ServerMessage : ResourceGroupNotFound: Resource group 'contoso' could not be found.
(System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError])
ServerResponse : {NotFound}
RequestMessage : {GET https://management.azure.com/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d/resourceGroups/co
ntoso/providers/Microsoft.Storage/storageAccounts/contoso?api-version=2016-12-01}
InvocationInfo : {Get-AzStorageAccount}
Line : Get-AzStorageAccount -ResourceGroupName contoso -Name contoso
Position : At line:1 char:1
+ Get-AzStorageAccount -ResourceGroupName contoso -Name contoso
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace : at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<GetPropertiesWithHttpMessagesAsync
>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<GetPropertiesAsync>d__7.
MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.GetProperties(IStorageAcc
ountsOperations operations, String resourceGroupName, String accountName)
at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet() in C:\
zd\azure-powershell\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\GetAzureSto
rageAccount.cs:line 70
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in
C:\zd\azure-powershell\src\Common\Commands.Common\AzurePSCmdlet.cs:line 642
HistoryId : 8
HistoryId: 5
Message : Run Connect-AzAccount to login.
StackTrace : at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.get_DefaultContext() in C:\zd\azur
e-powershell\src\ResourceManager\Common\Commands.ResourceManager.Common\AzureRmCmdlet.cs:line 85
at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.LogCmdletStartInvocationInfo() in
C:\zd\azure-powershell\src\ResourceManager\Common\Commands.ResourceManager.Common\AzureRmCmdlet.cs:lin
e 269
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.BeginProcessing() in
C:\zd\azure-powershell\src\Common\Commands.Common\AzurePSCmdlet.cs:line 299
at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.BeginProcessing() in C:\zd\azure-p
owershell\src\ResourceManager\Common\Commands.ResourceManager.Common\AzureRmCmdlet.cs:line 320
at Microsoft.Azure.Commands.Profile.GetAzureRMSubscriptionCommand.BeginProcessing() in C:\zd\azure-
powershell\src\ResourceManager\Profile\Commands.Profile\Subscription\GetAzureRMSubscription.cs:line 49
at System.Management.Automation.Cmdlet.DoBeginProcessing()
at System.Management.Automation.CommandProcessorBase.DoBegin()
Exception : System.Management.Automation.PSInvalidOperationException
InvocationInfo : {Get-AzSubscription}
Line : Get-AzSubscription
Position : At line:1 char:1
+ Get-AzSubscription
+ ~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 5
Obtenga detalles de todos los errores que se han producido en la sesión actual.
Ejemplo 3: Resolución de un error específico
Resolve-AzError $Error[0]
HistoryId: 8
RequestId : b61309e8-09c9-4f0d-ba56-08a6b28c731d
Message : Resource group 'contoso' could not be found.
ServerMessage : ResourceGroupNotFound: Resource group 'contoso' could not be found.
(System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError])
ServerResponse : {NotFound}
RequestMessage : {GET https://management.azure.com/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d/resourceGroups/co
ntoso/providers/Microsoft.Storage/storageAccounts/contoso?api-version=2016-12-01}
InvocationInfo : {Get-AzStorageAccount}
Line : Get-AzStorageAccount -ResourceGroupName contoso -Name contoso
Position : At line:1 char:1
+ Get-AzStorageAccount -ResourceGroupName contoso -Name contoso
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace : at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<GetPropertiesWithHttpMessagesAsync
>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<GetPropertiesAsync>d__7.
MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.GetProperties(IStorageAcc
ountsOperations operations, String resourceGroupName, String accountName)
at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet() in C:\
zd\azure-powershell\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\GetAzureSto
rageAccount.cs:line 70
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in
C:\zd\azure-powershell\src\Common\Commands.Common\AzurePSCmdlet.cs:line 642
HistoryId : 8
Obtenga los detalles del error especificado.
Parámetros
-DefaultProfile
Las credenciales, el inquilino y la suscripción que se usan para la comunicación con Azure
Tipo: | IAzureContextContainer |
Alias: | AzContext, AzureRmContext, AzureCredential |
Posición: | Named |
Valor predeterminado: | None |
Requerido: | False |
Aceptar entrada de canalización: | False |
Aceptar caracteres comodín: | False |
-Error
Uno o varios registros de error que se van a resolver. Si no se especifica ningún parámetro, se resuelven todos los errores de la sesión.
Tipo: | ErrorRecord[] |
Posición: | 0 |
Valor predeterminado: | None |
Requerido: | False |
Aceptar entrada de canalización: | True |
Aceptar caracteres comodín: | False |
-Last
Resuelva solo el último error que se produjo en la sesión.
Tipo: | SwitchParameter |
Posición: | Named |
Valor predeterminado: | None |
Requerido: | True |
Aceptar entrada de canalización: | False |
Aceptar caracteres comodín: | False |