Gallery › Guest Configuration › Azure built-in policies
Linux virtual machines should enable Azure Disk Encryption or EncryptionAtHost.
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.2.1
Although a virtual machine's OS and data disks are encrypted-at-rest by default using platform managed keys; resource disks (temp disks), data caches, and data flowing between Compute and Storage resources are not encrypted. Use Azure Disk Encryption or EncryptionAtHost to remediate. Visit https://aka.ms/diskencryptioncomparison to compare encryption offerings. This policy requires two prerequisites to be deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Linux virtual machines should enable Azure Disk Encryption or EncryptionAtHost.",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Although a virtual machine's OS and data disks are encrypted-at-rest by default using platform managed keys; resource disks (temp disks), data caches, and data flowing between Compute and Storage resources are not encrypted. Use Azure Disk Encryption or EncryptionAtHost to remediate. Visit https://aka.ms/diskencryptioncomparison to compare encryption offerings. This policy requires two prerequisites to be deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.",
"metadata": {
"category": "Guest Configuration",
"version": "1.2.1",
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "AzureLinuxVMEncryptionCompliance",
"version": "1.*"
}
},
"version": "1.2.1",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of this policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"allOf": [
{
"field": "Microsoft.Compute/virtualMachines/securityProfile.securityType",
"notEquals": "ConfidentialVM"
},
{
"field": "Microsoft.Compute/virtualMachines/additionalCapabilities.ultraSSDEnabled",
"notEquals": "true"
},
{
"field": "Microsoft.Compute/virtualMachines/sku.name",
"notIn": [
"standard_a0",
"standard_a1",
"basic_a0",
"basic_a1",
"basic_a2",
"basic_a3",
"basic_a4"
]
},
{
"field": "Microsoft.Compute/imagePublisher",
"notIn": [
"microsoft-aks",
"AzureDatabricks"
]
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "aks*"
}
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"in": [
"qubole-inc",
"datastax",
"couchbase",
"scalegrid",
"checkpoint",
"paloaltonetworks",
"debian",
"credativ"
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "OpenLogic"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Oracle"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "RedHat"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "center-for-internet-security-inc"
},
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "cis-win*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Suse"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "11*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Canonical"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "12*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-dsvm"
},
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "dsvm-win*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "cloudera"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-ads"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "linux*"
}
]
},
{
"allOf": [
{
"anyOf": [
{
"field": "Microsoft.Compute/virtualMachines/osProfile.linuxConfiguration",
"exists": "true"
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
"like": "Linux*"
}
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"exists": "false"
},
{
"field": "Microsoft.Compute/imagePublisher",
"notIn": [
"OpenLogic",
"RedHat",
"credativ",
"Suse",
"Canonical",
"microsoft-dsvm",
"cloudera",
"microsoft-ads",
"center-for-internet-security-inc",
"Oracle",
"azureopenshift"
]
}
]
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "AzureLinuxVMEncryptionCompliance",
"existenceCondition": {
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
}
}
}
},
"versions": [
"1.2.1",
"1.2.0-PREVIEW",
"1.1.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/ca88aadc-6e2b-416c-9de2-5a0f01d1693f",
"name": "ca88aadc-6e2b-416c-9de2-5a0f01d1693f"
}# Converted from LinuxVMEncryption_AINE.json by ConvertTo-Bylaw.
Policy 'ca88aadc-6e2b-416c-9de2-5a0f01d1693f' {
Properties @{
DisplayName = 'Linux virtual machines should enable Azure Disk Encryption or EncryptionAtHost.'
Description = 'Although a virtual machine''s OS and data disks are encrypted-at-rest by default using platform managed keys; resource disks (temp disks), data caches, and data flowing between Compute and Storage resources are not encrypted. Use Azure Disk Encryption or EncryptionAtHost to remediate. Visit https://aka.ms/diskencryptioncomparison to compare encryption offerings. This policy requires two prerequisites to be deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.'
Category = 'Guest Configuration'
Version = '1.2.1'
PolicyVersion = '1.2.1'
Mode = 'Indexed'
Metadata = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'AzureLinuxVMEncryptionCompliance'; version = '1.*' } }
}
Parameter Effect @{
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of this policy'
}
Resource 'Microsoft.Compute/virtualMachines' {
When {
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -BeIn @('qubole-inc', 'datastax', 'couchbase', 'scalegrid', 'checkpoint', 'paloaltonetworks', 'debian', 'credativ')
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'OpenLogic'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'Oracle'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'RedHat'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'center-for-internet-security-inc'
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'cis-win*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'Suse'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '11*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'Canonical'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '12*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'microsoft-dsvm'
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'dsvm-win*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'cloudera'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'microsoft-ads'
Field 'Microsoft.Compute/imageOffer' | Must -BeLike 'linux*'
}
AllOf {
AnyOf {
Field osProfile.linuxConfiguration | Must -Exist
Field storageProfile.osDisk.osType | Must -BeLike 'Linux*'
}
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Not -Exist
Field 'Microsoft.Compute/imagePublisher' | Must -Not -BeIn @('OpenLogic', 'RedHat', 'credativ', 'Suse', 'Canonical', 'microsoft-dsvm', 'cloudera', 'microsoft-ads', 'center-for-internet-security-inc', 'Oracle', 'azureopenshift')
}
}
}
Field securityProfile.securityType | Must -Not -Be 'ConfidentialVM'
Field additionalCapabilities.ultraSSDEnabled | Must -Not -Be 'true'
Field sku.name | Must -Not -BeIn @('standard_a0', 'standard_a1', 'basic_a0', 'basic_a1', 'basic_a2', 'basic_a3', 'basic_a4')
Field 'Microsoft.Compute/imagePublisher' | Must -Not -BeIn @('microsoft-aks', 'AzureDatabricks')
}
Require 'imageSKU is like aks*' {
Field 'Microsoft.Compute/imageSKU' | Must -BeLike 'aks*'
}
}
AuditIfNotExists 'Microsoft.GuestConfiguration/guestConfigurationAssignments' -Name 'AzureLinuxVMEncryptionCompliance' -Effect (Param Effect) {
Require 'complianceStatus is Compliant' {
Field complianceStatus | Must -Be 'Compliant'
}
}
}Source: built-in-policies/policyDefinitions/Guest Configuration/LinuxVMEncryption_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw