-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
AzUpdateMgmtCenter_HCRP_AutoAssessmentMode_Modify.json
158 lines (158 loc) · 5.24 KB
/
AzUpdateMgmtCenter_HCRP_AutoAssessmentMode_Modify.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
{
"properties": {
"displayName": "Configure periodic checking for missing system updates on azure Arc-enabled servers",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Configure auto-assessment (every 24 hours) for OS updates on Azure Arc-enabled servers. You can control the scope of assignment according to machine subscription, resource group, location or tag. Learn more about this for Windows: https://aka.ms/computevm-windowspatchassessmentmode, for Linux: https://aka.ms/computevm-linuxpatchassessmentmode.",
"metadata": {
"version": "2.2.1",
"category": "Azure Update Manager"
},
"version": "2.2.1",
"parameters": {
"assessmentMode": {
"type": "String",
"metadata": {
"displayName": "Assessment mode",
"description": "Assessment mode for the machines."
},
"allowedValues": [
"ImageDefault",
"AutomaticByPlatform"
],
"defaultValue": "AutomaticByPlatform"
},
"osType": {
"type": "String",
"metadata": {
"displayName": "OS type",
"description": "OS type for the machines."
},
"allowedValues": [
"Windows",
"Linux"
],
"defaultValue": "Windows"
},
"locations": {
"type": "Array",
"metadata": {
"displayName": "Machines locations",
"description": "The list of locations from which machines need to be targeted.",
"strongType": "location"
},
"defaultValue": []
},
"tagValues": {
"type": "Object",
"metadata": {
"displayName": "Tags on machines",
"description": "The list of tags that need to matched for getting target machines."
},
"defaultValue": {}
},
"tagOperator": {
"type": "String",
"metadata": {
"displayName": "Tag operator",
"description": "Matching condition for resource tags"
},
"allowedValues": [
"All",
"Any"
],
"defaultValue": "Any"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/machines/osName",
"equals": "[parameters('osType')]"
},
{
"anyOf": [
{
"value": "[empty(parameters('locations'))]",
"equals": true
},
{
"field": "location",
"in": "[parameters('locations')]"
}
]
},
{
"field": "[if(equals(tolower(parameters('osType')), 'windows'), 'Microsoft.HybridCompute/machines/osProfile.windowsConfiguration.patchSettings.assessmentMode', 'Microsoft.HybridCompute/machines/osProfile.linuxConfiguration.patchSettings.assessmentMode')]",
"notEquals": "[parameters('assessmentMode')]"
},
{
"anyOf": [
{
"value": "[empty(parameters('tagValues'))]",
"equals": true
},
{
"allOf": [
{
"value": "[parameters('tagOperator')]",
"equals": "Any"
},
{
"value": "[greaterOrEquals(if(empty(field('tags')), 0, length(intersection(parameters('tagValues'), field('tags')))), 1)]",
"equals": true
}
]
},
{
"allOf": [
{
"value": "[parameters('tagOperator')]",
"equals": "All"
},
{
"value": "[equals(if(empty(field('tags')), 0, length(intersection(parameters('tagValues'), field('tags')))), length(parameters('tagValues')))]",
"equals": true
}
]
}
]
}
]
},
"then": {
"effect": "modify",
"details": {
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/cd570a14-e51a-42ad-bac8-bafd67325302"
],
"conflictEffect": "audit",
"operations": [
{
"condition": "[equals(tolower(parameters('osType')), 'windows')]",
"operation": "addOrReplace",
"field": "Microsoft.HybridCompute/machines/osProfile.windowsConfiguration.patchSettings.assessmentMode",
"value": "[parameters('assessmentMode')]"
},
{
"condition": "[equals(tolower(parameters('osType')), 'linux')]",
"operation": "addOrReplace",
"field": "Microsoft.HybridCompute/machines/osProfile.linuxConfiguration.patchSettings.assessmentMode",
"value": "[parameters('assessmentMode')]"
}
]
}
}
},
"versions": [
"2.2.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/bfea026e-043f-4ff4-9d1b-bf301ca7ff46",
"name": "bfea026e-043f-4ff4-9d1b-bf301ca7ff46"
}