Gallery › SQL › Azure built-in policies
PostgreSQL servers should use customer-managed keys to encrypt data at rest
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.4
Use customer-managed keys to manage the encryption at rest of your PostgreSQL servers. By default, the data is encrypted at rest with service-managed keys, but customer-managed keys are commonly required to meet regulatory compliance standards. Customer-managed keys enable the data to be encrypted with an Azure Key Vault key created and owned by you. You have full control and responsibility for the key lifecycle, including rotation and management.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "PostgreSQL servers should use customer-managed keys to encrypt data at rest",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Use customer-managed keys to manage the encryption at rest of your PostgreSQL servers. By default, the data is encrypted at rest with service-managed keys, but customer-managed keys are commonly required to meet regulatory compliance standards. Customer-managed keys enable the data to be encrypted with an Azure Key Vault key created and owned by you. You have full control and responsibility for the key lifecycle, including rotation and management.",
"metadata": {
"version": "1.0.4",
"category": "SQL"
},
"version": "1.0.4",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.DBforPostgreSQL/servers"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.DBforPostgreSQL/servers/keys",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.DBforPostgreSQL/servers/keys/serverKeyType",
"equals": "AzureKeyVault"
},
{
"field": "Microsoft.DBforPostgreSQL/servers/keys/uri",
"notEquals": ""
},
{
"field": "Microsoft.DBforPostgreSQL/servers/keys/uri",
"exists": "true"
}
]
}
}
}
},
"versions": [
"1.0.4"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/18adea5e-f416-4d0f-8aa8-d24321e3e274",
"name": "18adea5e-f416-4d0f-8aa8-d24321e3e274"
}# Converted from PostgreSQL_EnableByok_Audit.json by ConvertTo-Bylaw.
Policy '18adea5e-f416-4d0f-8aa8-d24321e3e274' {
Properties @{
DisplayName = 'PostgreSQL servers should use customer-managed keys to encrypt data at rest'
Description = 'Use customer-managed keys to manage the encryption at rest of your PostgreSQL servers. By default, the data is encrypted at rest with service-managed keys, but customer-managed keys are commonly required to meet regulatory compliance standards. Customer-managed keys enable the data to be encrypted with an Azure Key Vault key created and owned by you. You have full control and responsibility for the key lifecycle, including rotation and management.'
Version = '1.0.4'
Category = 'SQL'
PolicyVersion = '1.0.4'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBforPostgreSQL/servers'
AuditIfNotExists 'Microsoft.DBforPostgreSQL/servers/keys' -Effect (Param Effect) {
Require 'serverKeyType is AzureKeyVault, uri is not and uri exists' {
Field serverKeyType | Must -Be 'AzureKeyVault'
Field uri | Must -Not -Be '' -IfPresent
Field uri | Must -Exist
}
}
}Source: built-in-policies/policyDefinitions/SQL/PostgreSQL_EnableByok_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw