Skip to content

Set-AzAlertProcessingRule non-descriptive error when passing inputobject using get-AzAlertProcessingRule #27343

Open
@Pl4nky

Description

@Pl4nky

Description

When passing an alert processing rule from get-azalertprocessingrule to set-azalertprocessingrule via inputobject, a non-descriptive error is returned referencing a parameter that does not exist (not output by get-azalertprocessingrule nor in the relevent documentation for these cmdlets).

Set-AzAlertProcessingRule: Value cannot be null. (Parameter 'value')

Issue script & Debug output

PS> $rules = Get-azalertprocessingrule

PS> $rules[0]

Name                     Enabled LastModifiedAt         LastModifiedBy                       Type
----                     ------- --------------         --------------                       ----
rulename01 False   16/03/2025 11:41:46 PM 324120b1-b1bf-4542-8859-337e3ce74357 RemoveAllActionGroups

PS> $rules[0].Enabled = $true
PS> $debugpreference='continue'
PS> Set-AzAlertProcessingRule -InputObject $rule[0]
DEBUG: 10:31:45 AM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:31:45 AM - SetAzureAlertProcessingRule begin processing with ParameterSet 'ByInputObject'.
DEBUG: 10:31:45 AM - using account id '[email protected]'...
DEBUG: 10:31:45 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.AlertsManagement], Cmdlet = [Set-AzAlertProcessingRule]. Returning default value [True].
DEBUG: 10:31:45 AM - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [Az.AlertsManagement], Cmdlet = [Set-AzAlertProcessingRule]. Returning default value [False].
Set-AzAlertProcessingRule: Value cannot be null. (Parameter 'value')
DEBUG: 10:31:45 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.AlertsManagement], Cmdlet = [Set-AzAlertProcessingRule]. Returning default value [True].
DEBUG: 10:31:45 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:31:45 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.AlertsManagement:0.6.3; CommandName: Set-AzAlertProcessingRule; PSVersion: 7.4.3; IsSuccess: False; Duration: 00:00:00.0094558; SanitizeDuration: 00:00:00; Exception: Value cannot be null. (Parameter 'value');
DEBUG: 10:31:45 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:31:46 AM - SetAzureAlertProcessingRule end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     4.0.2                 Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     0.6.3                 Az.AlertsManagement                 {Get-AzAlert, Get-AzAlertObjectHistory, Get-AzAlertProcessingRule, Get-AzSmartGroup…}

Error output

Message        : Value cannot be null. (Parameter 'value')
StackTrace     :    at Microsoft.Azure.Commands.AlertsManagement.SetAzureAlertProcessingRule.ProcessRecordInternal()
                    at Microsoft.Azure.Commands.AlertsManagement.AlertsManagementBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentNullException
InvocationInfo : {Set-AzAlertProcessingRule}
Line           : set-azalertprocessingrule -InputObject $rules[0]
Position       : At line:1 char:1
                 + set-azalertprocessingrule -InputObject $rules[0]
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedneeds-triageThis is a new issue that needs to be triaged to the appropriate team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions