Beispiel #1
0
        public void AutomationRules_CreateorUpdate()
        {
            using (var context = MockContext.Start(this.GetType()))
            {
                var SecurityInsightsClient        = TestHelper.GetSecurityInsightsClient(context);
                var AutomationRuleId              = Guid.NewGuid().ToString();
                var AutomationRuleTriggeringLogic = new AutomationRuleTriggeringLogic()
                {
                    IsEnabled = false
                };
                var ActionConfiguration = new AutomationRuleRunPlaybookActionActionConfiguration()
                {
                    LogicAppResourceId = TestHelper.ActionLAResourceID,
                    TenantId           = TestHelper.TestEnvironment.Tenant
                };
                var AutomationRuleAction = new AutomationRuleRunPlaybookAction()
                {
                    Order = 1,
                    ActionConfiguration = ActionConfiguration
                };
                var AutomationRuleActions = new List <AutomationRuleAction>();
                AutomationRuleActions.Add(AutomationRuleAction);
                var AutomationRuleProperties = new AutomationRule()
                {
                    DisplayName     = "SDK Test",
                    Order           = 1,
                    TriggeringLogic = AutomationRuleTriggeringLogic,
                    Actions         = AutomationRuleActions
                };

                var AutomationRule = SecurityInsightsClient.AutomationRules.CreateOrUpdate(TestHelper.ResourceGroup, TestHelper.WorkspaceName, AutomationRuleId, AutomationRuleProperties);
                ValidateAutomationRule(AutomationRule);
                SecurityInsightsClient.AutomationRules.Delete(TestHelper.ResourceGroup, TestHelper.WorkspaceName, AutomationRuleId);
            }
        }
Beispiel #2
0
        private static AutomationRule GetDefaultAutomationRuleProperties()
        {
            var AutomationRuleTriggeringLogic = new AutomationRuleTriggeringLogic()
            {
                IsEnabled = false
            };
            var ActionConfiguration = new PlaybookActionProperties()
            {
                LogicAppResourceId = TestHelper.ActionLAResourceID,
                TenantId           = Guid.Parse(TestHelper.TestEnvironment.Tenant)
            };

            var AutomationRuleAction = new AutomationRuleRunPlaybookAction()
            {
                Order = 1,
                ActionConfiguration = ActionConfiguration
            };
            var AutomationRuleActions = new List <AutomationRuleAction>();

            AutomationRuleActions.Add(AutomationRuleAction);
            var AutomationRuleProperties = new AutomationRule()
            {
                DisplayName     = "SDK Test",
                Order           = 1,
                TriggeringLogic = AutomationRuleTriggeringLogic,
                Actions         = AutomationRuleActions
            };

            return(AutomationRuleProperties);
        }