-
Notifications
You must be signed in to change notification settings - Fork 5.1k
/
checkPolicyRestrictions.json
333 lines (333 loc) · 11.6 KB
/
checkPolicyRestrictions.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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
{
"swagger": "2.0",
"info": {
"title": "CheckPolicyRestrictionsClient",
"version": "2020-07-01"
},
"host": "management.azure.com",
"schemes": [
"https"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions": {
"post": {
"operationId": "PolicyRestrictions_CheckAtSubscriptionScope",
"description": "Checks what restrictions Azure Policy will place on a resource within a subscription.",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CheckRestrictionsRequest"
},
"description": "The check policy restrictions parameters."
}
],
"responses": {
"200": {
"description": "The restrictions that will be placed on the resource by Azure Policy.",
"schema": {
"$ref": "#/definitions/CheckRestrictionsResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../stable/2019-10-01/policyMetadata.json#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Check policy restrictions at subscription scope": {
"$ref": "./examples/PolicyRestrictions_CheckAtSubscriptionScope.json"
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions": {
"post": {
"operationId": "PolicyRestrictions_CheckAtResourceGroupScope",
"description": "Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the resource group the resource will be created in is already known.",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CheckRestrictionsRequest"
},
"description": "The check policy restrictions parameters."
}
],
"responses": {
"200": {
"description": "The restrictions that will be placed on the resource by Azure Policy.",
"schema": {
"$ref": "#/definitions/CheckRestrictionsResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../stable/2019-10-01/policyMetadata.json#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Check policy restrictions at resource group scope": {
"$ref": "./examples/PolicyRestrictions_CheckAtResourceGroupScope.json"
}
}
}
}
},
"definitions": {
"CheckRestrictionsRequest": {
"description": "The check policy restrictions parameters describing the resource that is being evaluated.",
"properties": {
"resourceDetails": {
"description": "The information about the resource that will be evaluated.",
"$ref": "#/definitions/CheckRestrictionsResourceDetails"
},
"pendingFields": {
"description": "The list of fields and values that should be evaluated for potential restrictions.",
"type": "array",
"items": {
"$ref": "#/definitions/PendingField"
},
"x-ms-identifiers": [
"field"
]
}
},
"required": [
"resourceDetails"
]
},
"CheckRestrictionsResourceDetails": {
"description": "The information about the resource that will be evaluated.",
"properties": {
"resourceContent": {
"description": "The resource content. This should include whatever properties are already known and can be a partial set of all resource properties.",
"type": "object"
},
"apiVersion": {
"description": "The api-version of the resource content.",
"type": "string"
},
"scope": {
"description": "The scope where the resource is being created. For example, if the resource is a child resource this would be the parent resource's resource ID.",
"type": "string"
}
},
"required": [
"resourceContent"
]
},
"PendingField": {
"description": "A field that should be evaluated against Azure Policy to determine restrictions.",
"properties": {
"field": {
"description": "The name of the field. This can be a top-level property like 'name' or 'type' or an Azure Policy field alias.",
"type": "string"
},
"values": {
"description": "The list of potential values for the field that should be evaluated against Azure Policy.",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"field"
]
},
"CheckRestrictionsResult": {
"description": "The result of a check policy restrictions evaluation on a resource.",
"properties": {
"fieldRestrictions": {
"description": "The restrictions that will be placed on various fields in the resource by policy.",
"type": "array",
"items": {
"$ref": "#/definitions/FieldRestrictions"
},
"x-ms-identifiers": [
"field"
],
"readOnly": true
},
"contentEvaluationResult": {
"description": "Evaluation results for the provided partial resource content.",
"properties": {
"policyEvaluations": {
"description": "Policy evaluation results against the given resource content. This will indicate if the partial content that was provided will be denied as-is.",
"type": "array",
"items": {
"$ref": "#/definitions/PolicyEvaluationResult"
},
"x-ms-identifiers": [
"/policyInfo/policyDefinitionId",
"/policyInfo/policySetDefinitionId",
"/policyInfo/policyDefinitionReferenceId",
"/policyInfo/policyAssignmentId"
]
}
},
"readOnly": true
}
}
},
"FieldRestrictions": {
"description": "The restrictions that will be placed on a field in the resource by policy.",
"properties": {
"field": {
"description": "The name of the field. This can be a top-level property like 'name' or 'type' or an Azure Policy field alias.",
"type": "string",
"readOnly": true
},
"restrictions": {
"description": "The restrictions placed on that field by policy.",
"type": "array",
"items": {
"$ref": "#/definitions/FieldRestriction"
},
"x-ms-identifiers": []
}
}
},
"FieldRestriction": {
"description": "The restrictions on a field imposed by a specific policy.",
"properties": {
"result": {
"description": "The type of restriction that is imposed on the field.",
"type": "string",
"enum": [
"Required",
"Removed",
"Deny"
],
"x-ms-enum": {
"name": "FieldRestrictionResult",
"modelAsString": true,
"values": [
{
"value": "Required",
"description": "The field and/or values are required by policy."
},
{
"value": "Removed",
"description": "The field will be removed by policy."
},
{
"value": "Deny",
"description": "The field and/or values will be denied by policy."
}
]
},
"readOnly": true
},
"defaultValue": {
"description": "The value that policy will set for the field if the user does not provide a value.",
"type": "string",
"readOnly": true
},
"values": {
"description": "The values that policy either requires or denies for the field.",
"type": "array",
"items": {
"type": "string"
},
"readOnly": true
},
"policy": {
"description": "The details of the policy that is causing the field restriction.",
"$ref": "#/definitions/PolicyReference",
"readOnly": true
}
}
},
"PolicyEvaluationResult": {
"description": "The result of a non-compliant policy evaluation against the given resource content.",
"properties": {
"policyInfo": {
"description": "The details of the policy that was evaluated.",
"$ref": "#/definitions/PolicyReference",
"readOnly": true
},
"evaluationResult": {
"description": "The result of the policy evaluation against the resource. This will typically be 'NonCompliant' but may contain other values if errors were encountered.",
"type": "string",
"readOnly": true
},
"evaluationDetails": {
"description": "The detailed results of the policy expressions and values that were evaluated.",
"$ref": "../../stable/2019-10-01/policyStates.json#/definitions/PolicyEvaluationDetails",
"readOnly": true
}
}
},
"PolicyReference": {
"description": "Resource identifiers for a policy.",
"properties": {
"policyDefinitionId": {
"description": "The resource identifier of the policy definition.",
"type": "string",
"readOnly": true
},
"policySetDefinitionId": {
"description": "The resource identifier of the policy set definition.",
"type": "string",
"readOnly": true
},
"policyDefinitionReferenceId": {
"description": "The reference identifier of a specific policy definition within a policy set definition.",
"type": "string",
"readOnly": true
},
"policyAssignmentId": {
"description": "The resource identifier of the policy assignment.",
"type": "string",
"readOnly": true
}
}
}
}
}