/
Keys_ValidityPeriod.json
65 lines (65 loc) · 2.11 KB
/
Keys_ValidityPeriod.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
{
"properties": {
"displayName": "Keys should have the specified maximum validity period",
"policyType": "BuiltIn",
"mode": "Microsoft.KeyVault.Data",
"description": "Manage your organizational compliance requirements by specifying the maximum amount of time in days that a key can be valid within your key vault.",
"metadata": {
"version": "1.0.1",
"category": "Key Vault"
},
"version": "1.0.1",
"parameters": {
"maximumValidityInDays": {
"type": "Integer",
"metadata": {
"displayName": "The maximum validity period in days",
"description": "Specify the maximum number of days a key can be valid for. Keys should be ephemeral. Using a key with a long validity period is not recommended."
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "'Audit' allows a non-compliant resource to be created, but flags it as non-compliant. 'Deny' blocks the resource creation. 'Disable' turns off the policy."
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.KeyVault.Data/vaults/keys"
},
{
"anyOf": [
{
"field": "Microsoft.KeyVault.Data/vaults/keys/attributes.expiresOn",
"exists": false
},
{
"field": "Microsoft.KeyVault.Data/vaults/keys/attributes.expiresOn",
"greater": "[addDays(field('Microsoft.KeyVault.Data/vaults/keys/attributes.createdOn'), parameters('maximumValidityInDays'))]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/49a22571-d204-4c91-a7b6-09b1a586fbc9",
"name": "49a22571-d204-4c91-a7b6-09b1a586fbc9"
}