Gallery › SQL › Azure Community Policy
Deny SQL database transparent data encryption disablement
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Deny the ability to disable transparent data encryption status for SQL databases
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 49 lines
{
"name": "55447183-07a0-4624-af6c-8b80f814444f",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Deny SQL database transparent data encryption disablement",
"description": "Deny the ability to disable transparent data encryption status for SQL databases",
"metadata": {
"version": "1.0.0",
"category": "SQL"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.SQL/servers/databases/transparentDataEncryption"
},
{
"field": "Microsoft.Sql/servers/databases/transparentDataEncryption/state",
"notEquals": "enabled"
},
{
"value": "[indexOf(split(field('fullName'),'/'), 'master')]",
"notEquals": 1
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw55447183-07a0-4624-af6c-8b80f814444f.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '55447183-07a0-4624-af6c-8b80f814444f' {
Properties @{
DisplayName = 'Deny SQL database transparent data encryption disablement'
Description = 'Deny the ability to disable transparent data encryption status for SQL databases'
Version = '1.0.0'
Category = 'SQL'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.SQL/servers/databases/transparentDataEncryption' {
When {
Field state | Must -Not -Be 'enabled'
}
Require 'fullName is as required' {
Arm '[indexOf(split(field(''fullName''),''/''), ''master'')]' | Must -Be 1
}
}
Effect (Param Effect)
}Source: policyDefinitions/SQL/deny-sql-database-transparent-data-encryption-disablement/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw