Description
Managed disks are encrypted at rest by default. Use a Disk Encryption Set if you need a customer-managed key. For temporary disks and caches on new VMs, check support for encryption at host.
Potential impact
Changing existing encryption settings can replace a disk or interrupt data access.
Remediation
Before changing the configuration, review the Terraform plan for replacements and verify your backup and recovery arrangements. If the VM uses guest-based Azure Disk Encryption, follow the documented migration to encryption at host before ADE retires on September 15, 2028.
Examples
Both excerpts use the same staging disk. The second selects the key for stored data with disk_encryption_set_id. Configure the set’s key access and verify the disk’s association. Guest and host encryption are configured separately.
Before
resource "azurerm_managed_disk" "example" {
name = "acctestmd"
location = "West US 2"
resource_group_name = azurerm_resource_group.example.name
storage_account_type = "Standard_LRS"
create_option = "Empty"
disk_size_gb = "1"
tags = {
environment = "staging"
}
}
After
resource "azurerm_managed_disk" "example" {
name = "acctestmd"
location = "West US 2"
resource_group_name = azurerm_resource_group.example.name
storage_account_type = "Standard_LRS"
create_option = "Empty"
disk_size_gb = "1"
disk_encryption_set_id = azurerm_disk_encryption_set.example.id
tags = {
environment = "staging"
}
}