New-AzSentinelAlertRule does not work with tactic parameter even if the values are formatted correctly #186
Open
Description
Environment
Windows build number:10.0.19043.0
PowerShell version (if applicable): 5.1
Any other software?
Az.SecurityInsights version 1.0.0
# Steps to reproduce
New-AzSentinelAlertRule `
-ResourceGroupName testrg`
-WorkspaceName testlaw`
-DisplayName "Test" `
-Description "Test Description" `
-Enabled `
-Query "AddonAzureBackupJobs\r\n| summarize arg_max(TimeGenerated,*) by JobUniqueId\r\n| where JobStatus == \"Failed\"" `
-QueryFrequency (New-TimeSpan -days 1) `
-QueryPeriod (New-TimeSpan -days 3) `
-Severity "Medium" `
-SuppressionDuration (New-TimeSpan -hours 3) `
-TriggerOperator 0 `
-TriggerThreshold 1 `
-Scheduled `
-Tactic "Impact"
or
$requiredTactic = New-Object System.Collections.Generic.List[string]
$requiredTactic.Add("Impact")
New-AzSentinelAlertRule `
-ResourceGroupName testrg`
-WorkspaceName testlaw`
-DisplayName "Test" `
-Description "Test Description" `
-Enabled `
-Query "AddonAzureBackupJobs\r\n| summarize arg_max(TimeGenerated,*) by JobUniqueId\r\n| where JobStatus == \"Failed\"" `
-QueryFrequency (New-TimeSpan -days 1) `
-QueryPeriod (New-TimeSpan -days 3) `
-Severity "Medium" `
-SuppressionDuration (New-TimeSpan -hours 3) `
-TriggerOperator 0 `
-TriggerThreshold 1 `
-Scheduled `
-Tactic $requiredTactic
# Expected behavior
Should add the Sentinel Rule with specified Tactic
# Actual behavior
I a getting an Error
New-AzSentinelAlertRule : Cannot convert 'null' to the type 'System.Collections.Generic.IList`1[System.String]' required by parameter 'Tactic'. Constructor on type
'System.Collections.Generic.IList`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' not found.
At line:18 char:26
+ -Tactic $requiredTactic
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-AzSentinelAlertRule], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Azure.Commands.SecurityInsights.Cmdlets.AlertRules.NewAlertRules
Activity