-
Notifications
You must be signed in to change notification settings - Fork 12
/
GetAlertRuleTemplates.go
230 lines (227 loc) · 16.1 KB
/
GetAlertRuleTemplates.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
package armsecurityinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplates.json
func ExampleAlertRuleTemplatesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsecurityinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewAlertRuleTemplatesClient().NewListPager("myRg", "myWorkspace", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.AlertRuleTemplatesList = armsecurityinsights.AlertRuleTemplatesList{
// Value: []armsecurityinsights.AlertRuleTemplateClassification{
// &armsecurityinsights.ScheduledAlertRuleTemplate{
// Name: to.Ptr("65360bb0-8986-4ade-a89d-af3cf44d28aa"),
// Type: to.Ptr("Microsoft.SecurityInsights/AlertRuleTemplates"),
// ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/AlertRuleTemplates/65360bb0-8986-4ade-a89d-af3cf44d28aa"),
// Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled),
// Properties: &armsecurityinsights.ScheduledAlertRuleTemplateProperties{
// Description: to.Ptr("This alert monitors changes to Amazon VPC (Virtual Private Cloud) settings such as new ACL entries and routes in route tables.\nMore information: https://medium.com/@GorillaStack/the-most-important-aws-cloudtrail-security-events-to-track-a5b9873f8255 \nand https://aws.amazon.com/vpc/"),
// AlertRulesCreatedByTemplateCount: to.Ptr[int32](0),
// CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-27T00:00:00Z"); return t}()),
// DisplayName: to.Ptr("Changes to Amazon VPC settings"),
// LastUpdatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T00:00:00Z"); return t}()),
// Query: to.Ptr("let timeframe = 1d;\nAWSCloudTrail\n| where TimeGenerated >= ago(timeframe)\n| where EventName == \"CreateNetworkAclEntry\"\n or EventName == \"CreateRoute\"\n| project TimeGenerated, EventName, EventTypeName, UserIdentityAccountId, UserIdentityPrincipalid, UserAgent, UserIdentityUserName, SessionMfaAuthenticated, SourceIpAddress, AWSRegion, EventSource, AdditionalEventData, ResponseElements\n| extend AccountCustomEntity = UserIdentityUserName, IPCustomEntity = SourceIpAddress"),
// QueryFrequency: to.Ptr("P1D"),
// QueryPeriod: to.Ptr("P1D"),
// RequiredDataConnectors: []*armsecurityinsights.AlertRuleTemplateDataSource{
// {
// ConnectorID: to.Ptr("AWS"),
// DataTypes: []*string{
// to.Ptr("AWSCloudTrail")},
// }},
// Severity: to.Ptr(armsecurityinsights.AlertSeverityLow),
// Status: to.Ptr(armsecurityinsights.TemplateStatusAvailable),
// Tactics: []*armsecurityinsights.AttackTactic{
// to.Ptr(armsecurityinsights.AttackTacticPrivilegeEscalation),
// to.Ptr(armsecurityinsights.AttackTacticLateralMovement)},
// Techniques: []*string{
// to.Ptr("T1037"),
// to.Ptr("T1021")},
// TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan),
// TriggerThreshold: to.Ptr[int32](0),
// Version: to.Ptr("1.0.1"),
// },
// },
// &armsecurityinsights.FusionAlertRuleTemplate{
// Name: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"),
// Type: to.Ptr("Microsoft.SecurityInsights/AlertRuleTemplates"),
// ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/AlertRuleTemplates/f71aba3d-28fb-450b-b192-4e76a83015c8"),
// Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion),
// Properties: &armsecurityinsights.FusionAlertRuleTemplateProperties{
// Description: to.Ptr("Microsoft Sentinel uses Fusion, a correlation engine based on scalable machine learning algorithms, to automatically detect multistage attacks by identifying combinations of anomalous behaviors and suspicious activities that are observed at various stages of the kill chain. On the basis of these discoveries, Azure Sentinel generates incidents that would otherwise be very difficult to catch. By design, these incidents are low-volume, high-fidelity, and high-severity, which is why this detection is turned ON by default.\n\nSince Fusion correlates multiple signals from various products to detect advanced multistage attacks, successful Fusion detections are presented as Fusion incidents on the Microsoft Sentinel Incidents page. This rule covers the following detections:\n- Fusion for emerging threats\n- Fusion for ransomware\n- Scenario-based Fusion detections (122 scenarios)\n\nTo enable these detections, we recommend you configure the following data connectors for best results:\n- Out-of-the-box anomaly detections\n- Azure Active Directory Identity Protection\n- Azure Defender\n- Azure Defender for IoT\n- Microsoft 365 Defender\n- Microsoft Cloud App Security \n- Microsoft Defender for Endpoint\n- Microsoft Defender for Identity\n- Microsoft Defender for Office 365\n- Palo Alto Networks\n- Scheduled analytics rules, both built-in and those created by your security analysts. Analytics rules must contain kill-chain (tactics) and entity mapping information in order to be used by Fusion.\n\nFor the full description of each detection that is supported by Fusion, go to https://aka.ms/SentinelFusion."),
// AlertRulesCreatedByTemplateCount: to.Ptr[int32](0),
// CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-25T00:00:00Z"); return t}()),
// DisplayName: to.Ptr("Advanced Multi-Stage Attack Detection"),
// LastUpdatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T00:00:00Z"); return t}()),
// Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh),
// SourceSettings: []*armsecurityinsights.FusionTemplateSourceSetting{
// {
// SourceName: to.Ptr("Anomalies"),
// },
// {
// SourceName: to.Ptr("Alert providers"),
// SourceSubTypes: []*armsecurityinsights.FusionTemplateSourceSubType{
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Azure Active Directory Identity Protection"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Azure Defender"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Azure Defender for IoT"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Microsoft 365 Defender"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Microsoft Cloud App Security"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Microsoft Defender for Endpoint"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Microsoft Defender for Identity"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Microsoft Defender for Office 365"),
// },
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(true),
// SeverityFilters: []*armsecurityinsights.AlertSeverity{
// to.Ptr(armsecurityinsights.AlertSeverityInformational),
// to.Ptr(armsecurityinsights.AlertSeverityLow),
// to.Ptr(armsecurityinsights.AlertSeverityMedium),
// to.Ptr(armsecurityinsights.AlertSeverityHigh)},
// },
// SourceSubTypeName: to.Ptr("Azure Sentinel scheduled analytics rules"),
// }},
// },
// {
// SourceName: to.Ptr("Raw logs from other sources"),
// SourceSubTypes: []*armsecurityinsights.FusionTemplateSourceSubType{
// {
// SeverityFilter: &armsecurityinsights.FusionTemplateSubTypeSeverityFilter{
// IsSupported: to.Ptr(false),
// },
// SourceSubTypeName: to.Ptr("Palo Alto Networks"),
// }},
// }},
// Status: to.Ptr(armsecurityinsights.TemplateStatusAvailable),
// Tactics: []*armsecurityinsights.AttackTactic{
// to.Ptr(armsecurityinsights.AttackTacticCollection),
// to.Ptr(armsecurityinsights.AttackTacticCommandAndControl),
// to.Ptr(armsecurityinsights.AttackTacticCredentialAccess),
// to.Ptr(armsecurityinsights.AttackTacticDefenseEvasion),
// to.Ptr(armsecurityinsights.AttackTacticDiscovery),
// to.Ptr(armsecurityinsights.AttackTacticExecution),
// to.Ptr(armsecurityinsights.AttackTacticExfiltration),
// to.Ptr(armsecurityinsights.AttackTacticImpact),
// to.Ptr(armsecurityinsights.AttackTacticInitialAccess),
// to.Ptr(armsecurityinsights.AttackTacticLateralMovement),
// to.Ptr(armsecurityinsights.AttackTacticPersistence),
// to.Ptr(armsecurityinsights.AttackTacticPrivilegeEscalation)},
// },
// },
// &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleTemplate{
// Name: to.Ptr("b3cfc7c0-092c-481c-a55b-34a3979758cb"),
// Type: to.Ptr("Microsoft.SecurityInsights/AlertRuleTemplates"),
// ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/AlertRuleTemplates/b3cfc7c0-092c-481c-a55b-34a3979758cb"),
// Kind: to.Ptr(armsecurityinsights.AlertRuleKindMicrosoftSecurityIncidentCreation),
// Properties: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties{
// Description: to.Ptr("Create incidents based on all alerts generated in Microsoft Cloud App Security"),
// AlertRulesCreatedByTemplateCount: to.Ptr[int32](0),
// CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-16T00:00:00Z"); return t}()),
// DisplayName: to.Ptr("Create incidents based on Microsoft Cloud App Security alerts"),
// LastUpdatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-27T00:00:00Z"); return t}()),
// Status: to.Ptr(armsecurityinsights.TemplateStatusAvailable),
// ProductFilter: to.Ptr(armsecurityinsights.MicrosoftSecurityProductNameMicrosoftCloudAppSecurity),
// },
// }},
// }
}
}