Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.81k forks source link

Get-AzAutomationRunbook returns Object reference not set to an instance of an object error #25143

Open Madhufuture opened 2 months ago

Madhufuture commented 2 months ago

Description

Running Get-AzAutomationRunbook commands gives Object reference not set exception. I have verified the parameters that are being passed are valid.

Issue script & Debug output

PS C:\Users\MadhuRaju> Get-AzAutomationRunbook -ResourceGroupName 'dev-rg-ng-infra-shared-eau' -AutomationAccountName 'dev-aa-ng-infra' -Name 'Retire-Container-App'
DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Desktop]. PSVersion is [5.1.22621.2506].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\Program
Files\WindowsPowerShell\Modules\Az.Accounts\3.0.0\StartupScripts\..\lib].
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 1:59:58 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 1:59:58 PM - GetAzureAutomationRunbook begin processing with ParameterSet 'ByRunbookName'.
DEBUG: 1:59:58 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning
 default value [True].
DEBUG: 1:59:58 PM - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [], Cmdlet = [].
Returning default value [False].
Get-AzAutomationRunbook : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-AzAutomationRunbook -ResourceGroupName 'dev-rg-ng-infra-shared-ea ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzAutomationRunbook], NullReferenceException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.GetAzureAutomationRunbook

DEBUG: 1:59:58 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning
 default value [True].
DEBUG: 1:59:58 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 1:59:58 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default
value [True].
DEBUG: AzureQoSEvent:  Module: Az.Automation:1.10.0; CommandName: Get-AzAutomationRunbook; PSVersion: 5.1.22621.2506;
IsSuccess: False; Duration: 00:00:00.2175639; SanitizeDuration: 00:00:00; Exception: Object reference not set to an
instance of an object.;
DEBUG: 1:59:58 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default
 value [True].
DEBUG: 1:59:58 PM - GetAzureAutomationRunbook end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.0.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-...
Script     1.10.0     Az.Automation                       {Export-AzAutomationDscConfiguration, Export-AzAutomationDs...

Error output

DEBUG: 2:05:41 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 2:05:41 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 2:05:41 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning
 default value [True].
DEBUG: 2:05:41 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning
default value [True].

   HistoryId: 2

Message        : Object reference not set to an instance of an object.
StackTrace     :    at Microsoft.Azure.Commands.Automation.Common.AutomationPSClient..ctor(IAzureContext context)
                    at Microsoft.Azure.Commands.Automation.Cmdlet.AzureAutomationBaseCmdlet.get_AutomationClient()
                    at Microsoft.Azure.Commands.Automation.Cmdlet.GetAzureAutomationRunbook.AutomationProcessRecord()
                    at Microsoft.Azure.Commands.Automation.Cmdlet.AzureAutomationBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.NullReferenceException
InvocationInfo : {Get-AzAutomationRunbook}
Line           : Get-AzAutomationRunbook -ResourceGroupName 'dev-rg-ng-infra-shared-eau' -AutomationAccountName
                 'dev-aa-ng-infra' -Name 'Retire-Container-App'
Position       : At line:1 char:1
                 + Get-AzAutomationRunbook -ResourceGroupName 'dev-rg-ng-infra-shared-ea ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 2

DEBUG: 2:05:41 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 2:05:41 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default
value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:3.0.0; CommandName: Resolve-AzError; PSVersion: 5.1.22621.2506; IsSuccess:
True; Duration: 00:00:00.1091753; SanitizeDuration: 00:00:00.0127862
DEBUG: 2:05:41 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default
 value [True].
DEBUG: 2:05:41 PM - ResolveError end processing.
Madhufuture commented 2 months ago

Hello, is there any update on this issue?

microsoft-github-policy-service[bot] commented 2 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jaspkaur28, @sanjkum.