-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
ArcEnabledSQLServer_SubscribeESU_DINE.json
180 lines (180 loc) · 6.78 KB
/
ArcEnabledSQLServer_SubscribeESU_DINE.json
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
{
"properties": {
"displayName": "Subscribe eligible Arc-enabled SQL Servers instances to Extended Security Updates.",
"description": "Subscribe eligible Arc-enabled SQL Servers instances with License Type set to Paid or PAYG to Extended Security Updates. More on extended security updates https://go.microsoft.com/fwlink/?linkid=2239401.",
"policyType": "BuiltIn",
"mode": "Indexed",
"metadata": {
"version": "1.0.0",
"category": "SQL Server"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy."
},
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists"
},
"enableESU": {
"type": "Boolean",
"metadata": {
"displayName": "Enable Extended Security Updates",
"description": "Should be true to enable the ESU subscription for every SQL Server instance in the selected scope, false otherwise."
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines/extensions"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "WindowsAgent.SqlServer"
},
{
"anyOf": [
{
"value": "[if (empty(field('Microsoft.HybridCompute/machines/extensions/settings')), 0, length(intersection(field('Microsoft.HybridCompute/machines/extensions/settings'), createObject('LicenseType', 'PAYG'))))]",
"equals": 1
},
{
"value": "[if (empty(field('Microsoft.HybridCompute/machines/extensions/settings')), 0, length(intersection(field('Microsoft.HybridCompute/machines/extensions/settings'), createObject('LicenseType', 'Paid'))))]",
"equals": 1
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.HybridCompute/machines/extensions",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/7392c568-9289-4bde-aaaa-b7131215889d",
"/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"
],
"name": "[field('fullName')]",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.HybridCompute/machines/extensions/settings",
"exists": "true"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/settings",
"ContainsKey": "enableExtendedSecurityUpdates"
},
{
"value": "[length(intersection(field('Microsoft.HybridCompute/machines/extensions/settings'), createObject('enableExtendedSecurityUpdates', parameters('enableESU'))))]",
"equals": 1
}
]
},
"evaluationDelay": "AfterProvisioningSuccess",
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"extensionName": {
"type": "string",
"metadata": {
"description": "The Resource name of the Arc server extension."
}
},
"enableESU": {
"type": "bool",
"metadata": {
"description": "Indicates the enablement/disablement of ESU."
}
},
"currentEpoch": {
"type": "int",
"metadata": {
"description": "The current epoch."
},
"defaultValue": "[dateTimeToEpoch(utcNow())]"
},
"vmLocation": {
"type": "string",
"metadata": {
"description": "The location of the Arc server."
}
},
"agentName": {
"type": "string",
"metadata": {
"description": "Name of the agent, i.e. WindowsAgent.SQLServer."
}
},
"existingSettings": {
"type": "object",
"metadata": {
"description": "The Existing settings on the extension."
}
}
},
"functions": [],
"variables": {
"vmExtensionPublisher": "Microsoft.AzureData",
"esuSettings": {
"enableExtendedSecurityUpdates": "[parameters('enableESU')]",
"esuLastUpdatedTimestamp": "[dateTimeFromEpoch(parameters('currentEpoch'))]"
}
},
"resources": [
{
"name": "[parameters('extensionName')]",
"type": "Microsoft.HybridCompute/machines/extensions",
"location": "[parameters('vmLocation')]",
"apiVersion": "2022-11-10",
"properties": {
"publisher": "[variables('vmExtensionPublisher')]",
"type": "[parameters('agentName')]",
"settings": "[union(parameters('existingSettings'), variables('esuSettings'))]"
}
}
],
"outputs": {}
},
"parameters": {
"extensionName": {
"value": "[field('fullName')]"
},
"vmLocation": {
"value": "[field('location')]"
},
"agentName": {
"value": "[field('name')]"
},
"existingSettings": {
"value": "[field('Microsoft.HybridCompute/machines/extensions/settings')]"
},
"enableESU": {
"value": "[parameters('enableESU')]"
}
}
}
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/f692cc79-76fb-4c61-8861-467e454ac6f8",
"name": "f692cc79-76fb-4c61-8861-467e454ac6f8"
}