Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.25k stars 3.85k forks source link

get-azsentinelalertruletemplate - Value is null #14809

Closed directorcia closed 3 years ago

directorcia commented 3 years ago

Description


The cmdlet get-azsentinelalertruletemplate returns "value is null" error when run with parameters and interactively.

Steps to reproduce


$AlertRuleTemplates = Get-AzSentinelAlertRuleTemplate -ResourceGroupName "MyResourceGroup" -WorkspaceName "MyWorkspaceName"

Get-AzSentinelAlertRuleTemplate : Value cannot be null. Parameter name: source At line:1 char:1

cmdlet Get-AzSentinelAlertRuleTemplate at command pipeline position 1 Supply values for the following parameters: (Type !? for Help.) ResourceGroupName: MyResourceGroup WorkspaceName: MyWorkspaceName Get-AzSentinelAlertRuleTemplate: Value cannot be null. (Parameter 'source')

Environment data


$PSVersion

Name Value


PSVersion 7.1.3 PSEdition Core GitCommitId 7.1.3 OS Microsoft Windows 10.0.19042 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 PSEdition ExportedCommands


Script 0.1.0 Az.SecurityInsights Core,Desk {Get-AzSentinelAlertRuleAction, New-AzS…

Debug output


Get-AzSentinelAlertRuleTemplate: Resource group 'MyResourceGroup' could not be found.

Error output

PS C:\Windows\System32> Resolve-AzError WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' : The Resolve-Error alias will be removed in a future release. Please change any scripts that use this alias to use Resolve-AzError instead. Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

HistoryId: 9

RequestId : d507a95a-170e-46b4-b261-706ad6fa9373 Message : Resource group 'MyResourceGroup' could not be found. ServerMessage : ResourceGroupNotFound: Resource group 'MyResourceGroup' could not be found. (System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError]) ServerResponse : {NotFound} RequestMessage : {GET https://management.azure.com/subscriptions/8a6d2938-80eb-43bf-9a78-1427a031ab90/resourceGroups/ci aops/providers/Microsoft.OperationalInsights/workspaces/mms-seau/providers/Microsoft.SecurityInsights/ alertRuleTemplates?api-version=2020-01-01} InvocationInfo : {Get-AzSentinelAlertRuleTemplate} Line : Get-AzSentinelAlertRuleTemplate Position : At line:1 char:1

Message : A parameter cannot be found that matches parameter name 'listallavailable'. StackTrace : at System.Management.Automation.CmdletParameterBinderController.VerifyArgumentsProcessed(ParameterB indingException originalBindingException) at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidati on(Collection1 arguments) at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection1 arguments) at System.Management.Automation.CommandProcessor.BindCommandLineParameters() at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues) at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues) at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream) at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) --- End of stack trace from previous location --- at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext) at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) Exception : System.Management.Automation.ParameterBindingException InvocationInfo : {Get-Module} Line : Get-Module -listallavailable Position : At line:1 char:13

Message : Value cannot be null. (Parameter 'source') StackTrace : at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable1 source, Func2 selector) at Microsoft.Azure.Commands.SecurityInsights.Models.AlertRuleTemplates.PSSentinelAlertRuleTemplateC onvertors.ConvertToPSType(IEnumerable1 value) at Microsoft.Azure.Commands.SecurityInsights.Models.AlertRuleTemplates.PSSentinelAlertRuleTemplateC onvertors.ConvertToPSType(ScheduledAlertRuleTemplate value) at Microsoft.Azure.Commands.SecurityInsights.Models.AlertRuleTemplates.PSSentinelAlertRuleTemplateC onvertors.ConvertToPSType(AlertRuleTemplate value) at Microsoft.Azure.Commands.SecurityInsights.Models.AlertRuleTemplates.PSSentinelAlertRuleTemplateC onvertors.<>c.<ConvertToPSType>b__1_0(AlertRuleTemplate dss) at System.Linq.Enumerable.SelectEnumerableIterator2.ToList() at Microsoft.Azure.Commands.SecurityInsights.Models.AlertRuleTemplates.PSSentinelAlertRuleTemplateC onvertors.ConvertToPSType(IEnumerable1 value) at Microsoft.Azure.Commands.SecurityInsights.Cmdlets.AlertRulesTemplates.GetAlertRuleTemplate.Execu teCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__31.<ExecuteSynchronously OrAsJob>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.ExecuteSynchronouslyOrAsJobT at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() Exception : System.ArgumentNullException InvocationInfo : {Get-AzSentinelAlertRuleTemplate} Line : Get-AzSentinelAlertRuleTemplate Position : At line:1 char:1

The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

dicolanl commented 3 years ago

@directorcia Please update your module to 0.2.0. Then try again.

directorcia commented 3 years ago

Done. Now working. Thanks.