Hi ! I'm trying to create a new scheduledQueryRule...
# getting-started
b
Hi ! I'm trying to create a new scheduledQueryRule including dimensions. From the docs I can see that the only possible values for "Action" is either AlertingActionArgs or LogToMetricActionArgs. I want to be able to specify the ActionGroup for my Logic App as well as a criteria property to include some dimensions to be sent to my Logic App. Since the Action parameter doesn't allow me to input both an ActionGroup and a Criteria i'm a bit at a lost here. What i'm basically trying to simulate is in the screenshots attached below. Can anyone point me to the right direction on this ? Thanks !
Copy code
return new ScheduledQueryRule($"{applicationInsights.Name}Query{alertRuleName}", new ScheduledQueryRuleArgs
            {
                Action = new AlertingActionArgs
                {
                    AznsAction = new AzNsActionGroupArgs
                    {
                        ActionGroup = new[]
                        {
                            $"/subscriptions/{subscriptionId}/resourceGroups/{actionResourceGroupName}/providers/microsoft.insights/actiongroups/{actionGroupName}"
                            
                        }
                        
                    },
                    OdataType = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
                    Severity = AlertSeverity.One,
                    Trigger = new TriggerConditionArgs
                    {
                        Threshold = 1,
                        ThresholdOperator = ConditionalOperator.GreaterThanOrEqual.ToString()
                    }
                },
                Enabled = Enabled.True,
                ResourceGroupName = applicationInsights.ResourceGroup,
                RuleName = ruleName,
                Description = $"Query search on : {ruleName} ",
                Location = applicationInsightsAccessor.GetResourceLocation(applicationInsights),
                Schedule = new ScheduleArgs
                {
                    FrequencyInMinutes = 5,
                    TimeWindowInMinutes = 5
                },
                Source = new SourceArgs
                {
                    DataSourceId = applicationInsightsAccessor.GetResourceId(applicationInsights),
                    Query = query,
                    QueryType = QueryType.ResultCount
                }
 });