Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Commit 9deae35

Browse files
matt-FFFFFFSystem
andauthored
Updated from upstream (#13)
Co-authored-by: System <noreply@azure.com>
1 parent 33e8c23 commit 9deae35

3 files changed

+323
-3
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# This file was auto generated
2+
resource "azurerm_policy_definition" "deploy_diagnostics_databricks" {
3+
name = "Deploy-Diagnostics-Databricks"
4+
policy_type = "Custom"
5+
mode = "All"
6+
display_name = "Deploy-Diagnostics-Databricks"
7+
description = "Apply diagnostic settings for Databricks - Log Analytics"
8+
9+
management_group_name = var.management_group_name
10+
policy_rule = <<POLICYRULE
11+
{
12+
"if": {
13+
"field": "type",
14+
"equals": "Microsoft.Databricks/workspaces"
15+
},
16+
"then": {
17+
"effect": "deployIfNotExists",
18+
"details": {
19+
"type": "Microsoft.Insights/diagnosticSettings",
20+
"name": "setByPolicy",
21+
"existenceCondition": {
22+
"allOf": [
23+
{
24+
"field": "Microsoft.Insights/diagnosticSettings/logs.enabled",
25+
"equals": "true"
26+
},
27+
{
28+
"field": "Microsoft.Insights/diagnosticSettings/metrics.enabled",
29+
"equals": "true"
30+
},
31+
{
32+
"field": "Microsoft.Insights/diagnosticSettings/workspaceId",
33+
"equals": "[parameters('logAnalytics')]"
34+
}
35+
]
36+
},
37+
"roleDefinitionIds": [
38+
"/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
39+
],
40+
"deployment": {
41+
"properties": {
42+
"mode": "incremental",
43+
"template": {
44+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
45+
"contentVersion": "1.0.0.0",
46+
"parameters": {
47+
"resourceName": {
48+
"type": "string"
49+
},
50+
"logAnalytics": {
51+
"type": "string"
52+
},
53+
"location": {
54+
"type": "string"
55+
}
56+
},
57+
"variables": {},
58+
"resources": [
59+
{
60+
"type": "Microsoft.Databricks/workspaces/providers/diagnosticSettings",
61+
"apiVersion": "2017-05-01-preview",
62+
"name": "[concat(parameters('resourceName'), '/', 'Microsoft.Insights/setByPolicy')]",
63+
"location": "[parameters('location')]",
64+
"dependsOn": [],
65+
"properties": {
66+
"workspaceId": "[parameters('logAnalytics')]",
67+
"metrics": [],
68+
"logs": [
69+
{
70+
"category": "dbfs",
71+
"enabled": true
72+
},
73+
{
74+
"category": "clusters",
75+
"enabled": true
76+
},
77+
{
78+
"category": "accounts",
79+
"enabled": true
80+
},
81+
{
82+
"category": "jobs",
83+
"enabled": true
84+
},
85+
{
86+
"category": "notebook",
87+
"enabled": true
88+
},
89+
{
90+
"category": "ssh",
91+
"enabled": true
92+
},
93+
{
94+
"category": "workspace",
95+
"enabled": true
96+
},
97+
{
98+
"category": "secrets",
99+
"enabled": true
100+
},
101+
{
102+
"category": "sqlPermissions",
103+
"enabled": true
104+
},
105+
{
106+
"category": "instancePools",
107+
"enabled": true
108+
}
109+
]
110+
}
111+
}
112+
],
113+
"outputs": {}
114+
},
115+
"parameters": {
116+
"logAnalytics": {
117+
"value": "[parameters('logAnalytics')]"
118+
},
119+
"location": {
120+
"value": "[field('location')]"
121+
},
122+
"resourceName": {
123+
"value": "[field('name')]"
124+
}
125+
}
126+
}
127+
}
128+
}
129+
}
130+
}
131+
POLICYRULE
132+
133+
parameters = <<PARAMETERS
134+
{
135+
"logAnalytics": {
136+
"type": "String",
137+
"metadata": {
138+
"displayName": "Log Analytics workspace",
139+
"description": "Select the Log Analytics workspace from dropdown list",
140+
"strongType": "omsWorkspace"
141+
}
142+
}
143+
}
144+
PARAMETERS
145+
146+
}
147+
148+
output "policydefinition_deploy_diagnostics_databricks" {
149+
value = azurerm_policy_definition.deploy_diagnostics_databricks
150+
}
151+
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# This file was auto generated
2+
resource "azurerm_policy_definition" "deploy_diagnostics_function" {
3+
name = "Deploy-Diagnostics-Function"
4+
policy_type = "Custom"
5+
mode = "All"
6+
display_name = "Deploy-Diagnostics-Function"
7+
description = "Apply diagnostic settings for Azure Function"
8+
9+
management_group_name = var.management_group_name
10+
policy_rule = <<POLICYRULE
11+
{
12+
"if": {
13+
"allOf": [
14+
{
15+
"field": "type",
16+
"equals": "Microsoft.Web/sites"
17+
},
18+
{
19+
"field": "kind",
20+
"equals": "functionapp"
21+
}
22+
]
23+
},
24+
"then": {
25+
"effect": "deployIfNotExists",
26+
"details": {
27+
"type": "Microsoft.Insights/diagnosticSettings",
28+
"name": "setByPolicy",
29+
"existenceCondition": {
30+
"allOf": [
31+
{
32+
"field": "Microsoft.Insights/diagnosticSettings/metrics.enabled",
33+
"equals": "true"
34+
},
35+
{
36+
"field": "Microsoft.Insights/diagnosticSettings/workspaceId",
37+
"equals": "[parameters('logAnalytics')]"
38+
}
39+
]
40+
},
41+
"roleDefinitionIds": [
42+
"/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
43+
],
44+
"deployment": {
45+
"properties": {
46+
"mode": "incremental",
47+
"template": {
48+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
49+
"contentVersion": "1.0.0.0",
50+
"parameters": {
51+
"resourceName": {
52+
"type": "string"
53+
},
54+
"logAnalytics": {
55+
"type": "string"
56+
},
57+
"location": {
58+
"type": "string"
59+
}
60+
},
61+
"variables": {},
62+
"resources": [
63+
{
64+
"type": "Microsoft.Web/sites/providers/diagnosticSettings",
65+
"apiVersion": "2017-05-01-preview",
66+
"name": "[concat(parameters('resourceName'), '/', 'Microsoft.Insights/setByPolicy')]",
67+
"location": "[parameters('location')]",
68+
"dependsOn": [],
69+
"properties": {
70+
"workspaceId": "[parameters('logAnalytics')]",
71+
"metrics": [
72+
{
73+
"category": "AllMetrics",
74+
"enabled": true,
75+
"retentionPolicy": {
76+
"days": 0,
77+
"enabled": false
78+
}
79+
}
80+
],
81+
"logs": [
82+
{
83+
"category": "FunctionAppLogs",
84+
"enabled": true
85+
}
86+
]
87+
}
88+
}
89+
],
90+
"outputs": {}
91+
},
92+
"parameters": {
93+
"logAnalytics": {
94+
"value": "[parameters('logAnalytics')]"
95+
},
96+
"location": {
97+
"value": "[field('location')]"
98+
},
99+
"resourceName": {
100+
"value": "[field('name')]"
101+
}
102+
}
103+
}
104+
}
105+
}
106+
}
107+
}
108+
POLICYRULE
109+
110+
parameters = <<PARAMETERS
111+
{
112+
"logAnalytics": {
113+
"type": "String",
114+
"metadata": {
115+
"displayName": "Log Analytics workspace",
116+
"description": "Select the Log Analytics workspace from dropdown list",
117+
"strongType": "omsWorkspace"
118+
}
119+
}
120+
}
121+
PARAMETERS
122+
123+
}
124+
125+
output "policydefinition_deploy_diagnostics_function" {
126+
value = azurerm_policy_definition.deploy_diagnostics_function
127+
}
128+

policydefinition-deploy_diagnostics_website.tf

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@ resource "azurerm_policy_definition" "deploy_diagnostics_website" {
1010
policy_rule = <<POLICYRULE
1111
{
1212
"if": {
13-
"field": "type",
14-
"equals": "Microsoft.Web/sites"
13+
"allOf": [
14+
{
15+
"field": "type",
16+
"equals": "Microsoft.Web/sites"
17+
},
18+
{
19+
"field": "kind",
20+
"notEquals": "functionapp"
21+
}
22+
]
1523
},
1624
"then": {
1725
"effect": "deployIfNotExists",
@@ -70,7 +78,40 @@ resource "azurerm_policy_definition" "deploy_diagnostics_website" {
7078
}
7179
}
7280
],
73-
"logs": []
81+
"logs": [
82+
{
83+
"category": "AppServiceAntivirusScanAuditLogs",
84+
"enabled": true
85+
},
86+
{
87+
"category": "AppServiceHTTPLogs",
88+
"enabled": true
89+
},
90+
{
91+
"category": "AppServiceConsoleLogs",
92+
"enabled": true
93+
},
94+
{
95+
"category": "AppServiceAppLogs",
96+
"enabled": true
97+
},
98+
{
99+
"category": "AppServiceFileAuditLogs",
100+
"enabled": true
101+
},
102+
{
103+
"category": "AppServiceAuditLogs",
104+
"enabled": true
105+
},
106+
{
107+
"category": "AppServiceIPSecAuditLogs",
108+
"enabled": true
109+
},
110+
{
111+
"category": "AppServicePlatformLogs",
112+
"enabled": true
113+
}
114+
]
74115
}
75116
}
76117
],

0 commit comments

Comments
 (0)