Hello,
I made this guide for you I hope you can archive what you are looking for;
links : https://learn.microsoft.com/en-us/azure/virtual-machines/disks-enable-host-based-encryption-portal?tabs=azure-powershell
https://www.reddit.com/r/AZURE/comments/1ci7by7/windows_virtual_machines_should_enable_azure_disk/
- Ensure Pre‑Requisites and Check Support
Before you proceed, verify the following:
Supported VM Size & Region: Not every VM size supports Encryption at host. Check the Azure documentation for the latest list of supported sizes and regions.
Permissions: You must have sufficient permissions (typically the Contributor role or higher on both the VM and its disk resources) to make encryption changes.
Backup: Backup your VM data or create a snapshot of the disks just in case you need to revert to your previous state.
- Remove Azure Disk Encryption (ADE)
Encryption at host cannot be enabled while the disks are encrypted with ADE. Therefore, you must first decrypt the VM’s OS and data disks.
Steps to Remove ADE:
Identify the Encryption Status:
In the Azure Portal, navigate to your VM and check its “Disks” blade (or the “Encryption” section if available) to confirm that ADE is enabled.
Run the Decryption Process:
**Using PowerShell:** If you set up ADE using PowerShell (such as with the `Set-AzVMDiskEncryptionExtension` cmdlet), you now need to disable it. For example:
powershell
```powershell
Disable-AzVMDiskEncryption `
-ResourceGroupName <YourResourceGroup> `
-VMName <YourVMName>
```
Monitor the progress. (Depending on your configuration, the command might vary. Microsoft’s documentation on removing Azure Disk Encryption can be a useful guide.)
**Using the Azure CLI:** Similarly, if you use CLI, there’s a command to disable disk encryption (check the current CLI reference as the procedures may evolve).
**Wait for Complete Decryption:**
This operation can take some time. Verify in the portal that your disks are now in an unencrypted state.
Confirm that any ADE-related extensions have been removed.
- Enable Encryption at Host
With your VM’s disks now decrypted and free of ADE, you can enable Encryption at host. This property is configured at the VM level.
Two Approaches:
A. Live Update (If Supported)
If your VM supports an in-place update, you might be able to update its encryption configuration by modifying its properties.
Stop the VM (If Required): Sometimes a stop–deallocate–start cycle is necessary to register configuration changes.
Update the VM Configuration:
Using Azure CLI: You can update the VM’s encryption profile by running a command like:
bash
az vm update \
--resource-group <YourResourceGroup> \
--name <YourVMName> \
--set encryptionProfile.encryptionAtHost=true
This command sets the property that tells Azure to enable host-level encryption.
Verify the Change:
Once updated, check the VM’s properties in the Azure Portal. The “Encryption at host” property should now indicate that it is enabled.
B. Redeploy the VM (If Live Update Isn’t Available)
Some VM configurations may require a rebuild:
- Detach the Disks:
- If necessary, detach the OS and data disks after decryption.
- Create a New VM with Encryption at Host Enabled:
- Using an ARM template, the Azure CLI, or the Azure Portal, create a new VM.
- When configuring the new VM, set the “Encryption at host” property to true. For example, in an ARM template the property might be under the VM’s
"securityProfile": { "encryptionAtHost": true }
.
- Attach the Existing Disks:
- Reattach your previously decrypted OS and/or data disks to this new VM.
- Test the New Deployment:
- Once the new VM is up and running, verify that everything is working as expected and that the encryption at host property is applied.
- Ensure Pre‑Requisites and Check Support
Before you proceed, verify the following:
- Supported VM Size & Region: Not every VM size supports Encryption at host. Check the Azure documentation for the latest list of supported sizes and regions.
- Permissions: You must have sufficient permissions (typically the Contributor role or higher on both the VM and its disk resources) to make encryption changes.
- Backup: Backup your VM data or create a snapshot of the disks just in case you need to revert to your previous state.
- Remove Azure Disk Encryption (ADE)
Encryption at host cannot be enabled while the disks are encrypted with ADE. Therefore, you must first decrypt the VM’s OS and data disks. Steps to Remove ADE:
- Identify the Encryption Status:
- In the Azure Portal, navigate to your VM and check its “Disks” blade (or the “Encryption” section if available) to confirm that ADE is enabled.
- Run the Decryption Process:
-ResourceGroupName <YourResourceGroup> `
-VMName <YourVMName>
```
Monitor the progress. (Depending on your configuration, the command might vary. Microsoft’s documentation on removing Azure Disk Encryption can be a useful guide.)
- **Using the Azure CLI:** Similarly, if you use CLI, there’s a command to disable disk encryption (check the current CLI reference as the procedures may evolve).
1. **Wait for Complete Decryption:**
- This operation can take some time. Verify in the portal that your disks are now in an unencrypted state.
- Confirm that any ADE-related extensions have been removed.
3. Enable Encryption at Host
With your VM’s disks now decrypted and free of ADE, you can enable Encryption at host. This property is configured at the VM level.
**Two Approaches:**
**A. Live Update (If Supported)**
If your VM supports an in-place update, you might be able to update its encryption configuration by modifying its properties.
1. **Stop the VM (If Required):** Sometimes a stop–deallocate–start cycle is necessary to register configuration changes.
1. **Update the VM Configuration:**
- **Using Azure CLI:** You can update the VM’s encryption profile by running a command like:
bash
```dockerfile
az vm update \
--resource-group <YourResourceGroup>
--name <YourVMName>
--set encryptionProfile.encryptionAtHost=true
```
This command sets the property that tells Azure to enable host-level encryption.
1. **Verify the Change:**
- Once updated, check the VM’s properties in the Azure Portal. The “Encryption at host” property should now indicate that it is enabled.
**B. Redeploy the VM (If Live Update Isn’t Available)**
Some VM configurations may require a rebuild:
1. **Detach the Disks:**
- If necessary, detach the OS and data disks after decryption.
1. **Create a New VM with Encryption at Host Enabled:**
- Using an ARM template, the Azure CLI, or the Azure Portal, create a new VM.
- When configuring the new VM, set the “Encryption at host” property to true. For example, in an ARM template the property might be under the VM’s `"securityProfile": { "encryptionAtHost": true }`.
1. **Attach the Existing Disks:**
- Reattach your previously decrypted OS and/or data disks to this new VM.
1. **Test the New Deployment:**
- Once the new VM is up and running, verify that everything is working as expected and that the encryption at host property is applied.
If the Answer is helpful, please click Accept Answer and Up-Vote, so that it can help others in the community looking for help on similar topics.