Gallery › Key Vault › Azure built-in policies
[Preview]: Azure Key Vault Managed HSM Keys should have more than the specified number of days before expiration
Doesn't convert yet Policy Audit Deny Disabled Mode Microsoft.ManagedHSM.Data Version 1.0.1-preview Preview
To use this policy in preview, you must first follow these instructions at https://aka.ms/mhsmgovernance. If a key is too close to expiration, an organizational delay to rotate the key may result in an outage. Keys should be rotated at a specified number of days prior to expiration to provide sufficient time to react to a failure.
ConvertTo-Bylaw can't convert this policy yet:
- BYL6002 Its mode, Microsoft.ManagedHSM.Data, is a resource provider mode, which language version 1.0 doesn't support.
Azure Policy JSONManagedHsm_Keys_Expiry_ByDays.json · 63 lines
{
"properties": {
"policyType": "BuiltIn",
"displayName": "[Preview]: Azure Key Vault Managed HSM Keys should have more than the specified number of days before expiration",
"description": "To use this policy in preview, you must first follow these instructions at https://aka.ms/mhsmgovernance. If a key is too close to expiration, an organizational delay to rotate the key may result in an outage. Keys should be rotated at a specified number of days prior to expiration to provide sufficient time to react to a failure.",
"metadata": {
"category": "Key Vault",
"version": "1.0.1-preview",
"preview": true
},
"version": "1.0.1-preview",
"mode": "Microsoft.ManagedHSM.Data",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit",
"metadata": {
"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.",
"displayName": "Effect"
},
"type": "String"
},
"minimumDaysBeforeExpiration": {
"metadata": {
"description": "Specify the minimum number of days that a key should remain usable prior to expiration.",
"displayName": "The minimum days before expiration"
},
"type": "Integer",
"defaultValue": 90
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ManagedHSM.Data/managedHsms/keys"
},
{
"field": "Microsoft.ManagedHSM.Data/managedHsms/keys/attributes.expiresOn",
"exists": true
},
{
"field": "Microsoft.ManagedHSM.Data/managedHsms/keys/attributes.expiresOn",
"less": "[addDays(utcNow(), parameters('minimumDaysBeforeExpiration'))]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/ad27588c-0198-4c84-81ef-08efd0274653",
"name": "ad27588c-0198-4c84-81ef-08efd0274653"
}Source: built-in-policies/policyDefinitions/Key Vault/ManagedHsm_Keys_Expiry_ByDays.json in Azure/azure-policy, under the MIT licence.
Bylaw