Skip to content

Commit 05b9819

Browse files
ayeletshpigelmananuchandy
authored andcommitted
Add serverSecurityAlertPolicies APIs for MySQL servers (#3644)
1 parent bfffaac commit 05b9819

File tree

4 files changed

+298
-0
lines changed

4 files changed

+298
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "00000000-1111-2222-3333-444444444444",
4+
"resourceGroupName": "securityalert-4799",
5+
"serverName": "securityalert-6440",
6+
"securityAlertPolicyName": "Default",
7+
"api-version": "2017-12-01",
8+
"parameters": {
9+
"properties": {
10+
"state": "Enabled",
11+
"emailAccountAdmins": true,
12+
"emailAddresses": ["[email protected]"],
13+
"disabledAlerts": ["Access_Anomaly", "Usage_Anomaly"],
14+
"retentionDays": 5,
15+
"storageAccountAccessKey": "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==",
16+
"storageEndpoint": "https://mystorage.blob.core.windows.net"
17+
}
18+
}
19+
},
20+
"responses": {
21+
"200": {
22+
"body": {
23+
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforMySQL/servers/securityalert-6440/securityAlertPolicies/default",
24+
"name": "Default",
25+
"type": "Microsoft.DBforMySQL/servers/securityAlertPolicies",
26+
"properties": {
27+
"state": "Enabled",
28+
"emailAccountAdmins": true,
29+
"emailAddresses": ["[email protected]"],
30+
"disabledAlerts": ["Access_Anomaly","Usage_Anomaly"],
31+
"retentionDays": 5,
32+
"storageEndpoint": "https://mystorage.blob.core.windows.net"
33+
}
34+
}
35+
},
36+
"202": {
37+
}
38+
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "00000000-1111-2222-3333-444444444444",
4+
"resourceGroupName": "securityalert-4799",
5+
"serverName": "securityalert-6440",
6+
"securityAlertPolicyName": "Default",
7+
"api-version": "2017-12-01",
8+
"parameters": {
9+
"properties": {
10+
"state": "Disabled",
11+
"emailAccountAdmins": true
12+
}
13+
}
14+
},
15+
"responses": {
16+
"200": {
17+
"body": {
18+
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforMySQL/servers/securityalert-6440/securityAlertPolicies/default",
19+
"name": "Default",
20+
"type": "Microsoft.DBforMySQL/servers/securityAlertPolicies",
21+
"properties": {
22+
"state": "Enabled",
23+
"emailAccountAdmins": true,
24+
"emailAddresses": [],
25+
"disabledAlerts": [],
26+
"retentionDays": 0,
27+
"storageEndpoint": ""
28+
}
29+
}
30+
},
31+
"202": {
32+
}
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "00000000-1111-2222-3333-444444444444",
4+
"resourceGroupName": "securityalert-4799",
5+
"serverName": "securityalert-6440",
6+
"securityAlertPolicyName": "Default",
7+
"api-version": "2017-03-01-preview"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforMySQL/servers/securityalert-6440/securityAlertPolicies/default",
13+
"name": "Default",
14+
"type": "Microsoft.DBforMySQL/servers/securityAlertPolicies",
15+
"properties": {
16+
"state": "Disabled",
17+
"emailAccountAdmins": true,
18+
"emailAddresses": [ "[email protected];[email protected]" ],
19+
"disabledAlerts": ["Access_Anomaly"],
20+
"retentionDays": 0,
21+
"storageEndpoint": "https://mystorage.blob.core.windows.net"
22+
}
23+
}
24+
}
25+
}
26+
}

specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,126 @@
10621062
}
10631063
}
10641064
},
1065+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}": {
1066+
"get": {
1067+
"tags": [
1068+
"ServerSecurityAlertPolicies"
1069+
],
1070+
"description": "Get a server's security alert policy.",
1071+
"operationId": "ServerSecurityAlertPolicies_Get",
1072+
"parameters": [
1073+
{
1074+
"$ref": "#/parameters/ResourceGroupParameter"
1075+
},
1076+
{
1077+
"$ref": "#/parameters/ServerNameParameter"
1078+
},
1079+
{
1080+
"name": "securityAlertPolicyName",
1081+
"in": "path",
1082+
"description": "The name of the security alert policy.",
1083+
"required": true,
1084+
"type": "string",
1085+
"enum": [
1086+
"Default"
1087+
],
1088+
"x-ms-enum": {
1089+
"name": "SecurityAlertPolicyName",
1090+
"modelAsString": true
1091+
}
1092+
},
1093+
{
1094+
"$ref": "#/parameters/SubscriptionIdParameter"
1095+
},
1096+
{
1097+
"$ref": "#/parameters/ApiVersionParameter"
1098+
}
1099+
],
1100+
"responses": {
1101+
"200": {
1102+
"description": "Successfully retrieved the server threat detection policy.",
1103+
"schema": {
1104+
"$ref": "#/definitions/ServerSecurityAlertPolicy"
1105+
}
1106+
},
1107+
"default": {
1108+
"description": "Error response describing why the operation of getting security alert policies failed."
1109+
}
1110+
},
1111+
"x-ms-examples": {
1112+
"Get a server's threat detection policy": {
1113+
"$ref": "./examples/ServerSecurityAlertsGet.json"
1114+
}
1115+
}
1116+
},
1117+
"put": {
1118+
"tags": [
1119+
"ServerSecurityAlertPolicies"
1120+
],
1121+
"description": "Creates or updates a threat detection policy.",
1122+
"operationId": "ServerSecurityAlertPolicies_CreateOrUpdate",
1123+
"parameters": [
1124+
{
1125+
"$ref": "#/parameters/ResourceGroupParameter"
1126+
},
1127+
{
1128+
"$ref": "#/parameters/ServerNameParameter"
1129+
},
1130+
{
1131+
"name": "securityAlertPolicyName",
1132+
"in": "path",
1133+
"description": "The name of the threat detection policy.",
1134+
"required": true,
1135+
"type": "string",
1136+
"enum": [
1137+
"Default"
1138+
],
1139+
"x-ms-enum": {
1140+
"name": "SecurityAlertPolicyName",
1141+
"modelAsString": true
1142+
}
1143+
},
1144+
{
1145+
"name": "parameters",
1146+
"in": "body",
1147+
"description": "The server security alert policy.",
1148+
"required": true,
1149+
"schema": {
1150+
"$ref": "#/definitions/ServerSecurityAlertPolicy"
1151+
}
1152+
},
1153+
{
1154+
"$ref": "#/parameters/SubscriptionIdParameter"
1155+
},
1156+
{
1157+
"$ref": "#/parameters/ApiVersionParameter"
1158+
}
1159+
],
1160+
"responses": {
1161+
"200": {
1162+
"description": "Successfully updated the threat detection policy.",
1163+
"schema": {
1164+
"$ref": "#/definitions/ServerSecurityAlertPolicy"
1165+
}
1166+
},
1167+
"default": {
1168+
"description": "Error response describing why the operation of setting security alert policies failed."
1169+
},
1170+
"202": {
1171+
"description": "Created request to set the server threat detection policy."
1172+
}
1173+
},
1174+
"x-ms-long-running-operation": true,
1175+
"x-ms-examples": {
1176+
"Update a server's threat detection policy with all parameters": {
1177+
"$ref": "./examples/ServerSecurityAlertsCreateMax.json"
1178+
},
1179+
"Update a server's threat detection policy with minimal parameters": {
1180+
"$ref": "./examples/ServerSecurityAlertsCreateMin.json"
1181+
}
1182+
}
1183+
}
1184+
},
10651185
"/providers/Microsoft.DBforMySQL/operations": {
10661186
"get": {
10671187
"tags": [
@@ -1916,6 +2036,74 @@
19162036
}
19172037
},
19182038
"description": "Represents a resource name availability."
2039+
},
2040+
"SecurityAlertPolicyProperties": {
2041+
"description": "Properties of a security alert policy.",
2042+
"required": [
2043+
"state"
2044+
],
2045+
"type": "object",
2046+
"properties": {
2047+
"state": {
2048+
"description": "Specifies the state of the policy, whether it is enabled or disabled.",
2049+
"enum": [
2050+
"Enabled",
2051+
"Disabled"
2052+
],
2053+
"type": "string",
2054+
"x-ms-enum": {
2055+
"name": "ServerSecurityAlertPolicyState",
2056+
"modelAsString": false
2057+
}
2058+
},
2059+
"disabledAlerts": {
2060+
"description": "Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly",
2061+
"type": "array",
2062+
"items": {
2063+
"type": "string"
2064+
}
2065+
},
2066+
"emailAddresses": {
2067+
"description": "Specifies an array of e-mail addresses to which the alert is sent.",
2068+
"type": "array",
2069+
"items": {
2070+
"type": "string"
2071+
}
2072+
},
2073+
"emailAccountAdmins": {
2074+
"description": "Specifies that the alert is sent to the account administrators.",
2075+
"type": "boolean"
2076+
},
2077+
"storageEndpoint": {
2078+
"description": "Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.",
2079+
"type": "string"
2080+
},
2081+
"storageAccountAccessKey": {
2082+
"description": "Specifies the identifier key of the Threat Detection audit storage account.",
2083+
"type": "string"
2084+
},
2085+
"retentionDays": {
2086+
"format": "int32",
2087+
"description": "Specifies the number of days to keep in the Threat Detection audit logs.",
2088+
"type": "integer"
2089+
}
2090+
}
2091+
},
2092+
"ServerSecurityAlertPolicy": {
2093+
"description": "A server security alert policy.",
2094+
"type": "object",
2095+
"allOf": [
2096+
{
2097+
"$ref": "#/definitions/ProxyResource"
2098+
}
2099+
],
2100+
"properties": {
2101+
"properties": {
2102+
"$ref": "#/definitions/SecurityAlertPolicyProperties",
2103+
"description": "Resource properties.",
2104+
"x-ms-client-flatten": true
2105+
}
2106+
}
19192107
}
19202108
},
19212109
"parameters": {
@@ -1988,6 +2176,17 @@
19882176
"type": "string",
19892177
"description": "The name of the location.",
19902178
"x-ms-parameter-location": "method"
2179+
},
2180+
"SecurityAlertPolicyNameParameter": {
2181+
"name": "securityAlertPolicyName",
2182+
"in": "path",
2183+
"description": "The name of the security alert policy.",
2184+
"required": true,
2185+
"type": "string",
2186+
"enum": [
2187+
"default"
2188+
],
2189+
"x-ms-parameter-location": "method"
19912190
}
19922191
}
19932192
}

0 commit comments

Comments
 (0)