Gallery › Guest Configuration › Azure built-in policies
Windows virtual machines should enable Azure Disk Encryption or EncryptionAtHost.
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.1.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": "Windows 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.1.1",
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "AzureWindowsVMEncryptionCompliance",
"version": "1.*"
}
},
"version": "1.1.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": [
"esri",
"incredibuild",
"MicrosoftDynamicsAX",
"MicrosoftSharepoint",
"MicrosoftVisualStudio",
"MicrosoftWindowsDesktop",
"MicrosoftWindowsServerHPCPack"
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "MicrosoftWindowsServer"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2008*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "MicrosoftSQLServer"
},
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "SQL2008*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-dsvm"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "dsvm-win*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-ads"
},
{
"field": "Microsoft.Compute/imageOffer",
"in": [
"standard-data-science-vm",
"windows-data-science-vm"
]
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "batch"
},
{
"field": "Microsoft.Compute/imageOffer",
"equals": "rendering-windows2016"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "center-for-internet-security-inc"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "cis-windows-server-201*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "pivotal"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "bosh-windows-server*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "cloud-infrastructure-services"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "ad*"
}
]
},
{
"allOf": [
{
"anyOf": [
{
"field": "Microsoft.Compute/virtualMachines/osProfile.windowsConfiguration",
"exists": "true"
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
"like": "Windows*"
}
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imageSKU",
"exists": "false"
},
{
"allOf": [
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2008*"
},
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "SQL2008*"
}
]
}
]
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "AzureWindowsVMEncryptionCompliance",
"existenceCondition": {
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
}
}
}
},
"versions": [
"1.1.1",
"1.1.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/3dc5edcd-002d-444c-b216-e123bbfa37c0",
"name": "3dc5edcd-002d-444c-b216-e123bbfa37c0"
}# Converted from WindowsVMEncryption_AINE.json by ConvertTo-Bylaw.
Policy '3dc5edcd-002d-444c-b216-e123bbfa37c0' {
Properties @{
DisplayName = 'Windows 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.1.1'
PolicyVersion = '1.1.1'
Mode = 'Indexed'
Metadata = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'AzureWindowsVMEncryptionCompliance'; 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 @('esri', 'incredibuild', 'MicrosoftDynamicsAX', 'MicrosoftSharepoint', 'MicrosoftVisualStudio', 'MicrosoftWindowsDesktop', 'MicrosoftWindowsServerHPCPack')
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'MicrosoftWindowsServer'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2008*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'MicrosoftSQLServer'
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'SQL2008*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'microsoft-dsvm'
Field 'Microsoft.Compute/imageOffer' | Must -BeLike 'dsvm-win*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'microsoft-ads'
Field 'Microsoft.Compute/imageOffer' | Must -BeIn @('standard-data-science-vm', 'windows-data-science-vm')
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'batch'
Field 'Microsoft.Compute/imageOffer' | Must -Be 'rendering-windows2016'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'center-for-internet-security-inc'
Field 'Microsoft.Compute/imageOffer' | Must -BeLike 'cis-windows-server-201*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'pivotal'
Field 'Microsoft.Compute/imageOffer' | Must -BeLike 'bosh-windows-server*'
}
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'cloud-infrastructure-services'
Field 'Microsoft.Compute/imageOffer' | Must -BeLike 'ad*'
}
AllOf {
AnyOf {
Field osProfile.windowsConfiguration | Must -Exist
Field storageProfile.osDisk.osType | Must -BeLike 'Windows*'
}
AnyOf {
Field 'Microsoft.Compute/imageSKU' | Must -Not -Exist
AllOf {
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2008*'
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'SQL2008*'
}
}
}
}
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 'AzureWindowsVMEncryptionCompliance' -Effect (Param Effect) {
Require 'complianceStatus is Compliant' {
Field complianceStatus | Must -Be 'Compliant'
}
}
}Source: built-in-policies/policyDefinitions/Guest Configuration/WindowsVMEncryption_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw