Skip to content

Commit 1be2081

Browse files
Merge pull request #304447 from AbhishekMallick-MS/Aug-20-2025-Freshness
Freshness/Page views improvement initiative - Restore VM secrets
2 parents 0713174 + 5459a69 commit 1be2081

3 files changed

Lines changed: 21 additions & 15 deletions

File tree

articles/backup/backup-azure-restore-key-secret.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
---
2-
title: Restore Key Vault key & secret for encrypted VM
3-
description: Learn how to restore Key Vault key and secret in Azure Backup using PowerShell
2+
title: Restore Key Vault key & secret for encrypted Azure VM
3+
description: Learn how to restore Key Vault key and secret for encrypted VMs via Azure PowerShell using Azure Backup.
44
ms.topic: how-to
55
ms.custom: devx-track-azurepowershell
6-
ms.date: 09/04/2024
6+
ms.date: 08/20/2025
77
author: AbhishekMallick-MS
88
ms.author: v-mallicka
99
# Customer intent: As a system administrator managing encrypted virtual machines, I want to restore keys and secrets to Azure Key Vault, so that I can successfully recover and create encrypted VMs from backup without losing data integrity and security.
1010
---
1111
# Restore Key Vault key and secret for encrypted VMs using Azure Backup
1212

13-
This article talks about using Azure VM Backup to perform restore of encrypted Azure VMs, if your key and secret don't exist in the key vault. These steps can also be used if you want to maintain a separate copy of the key (Key Encryption Key) and secret (BitLocker Encryption Key) for the restored VM.
13+
This article describes how to use Azure VM Backup to restore encrypted Azure Virtual Machines (VMs) when the original key and secret aren't available in the Key Vault. It's also applicable for scenarios where you want to maintain a separate copy of the key (Key Encryption Key) and secret (BitLocker Encryption Key) for the restored VM.
1414

1515
[!INCLUDE [updated-for-az](~/reusable-content/ce-skilling/azure/includes/updated-for-az.md)]
1616

1717
## Prerequisites
1818

19-
* **Backup encrypted VMs** - Encrypted Azure VMs have been backed up using Azure Backup. Refer to the article [Manage backup and restore of Azure VMs using PowerShell](backup-azure-vms-automation.md) for details about how to back up encrypted Azure VMs.
19+
Before you begin restoring an encrypted VM, ensure the following prerequisites are met:
20+
21+
* **Backup encrypted VMs** - Encrypted Azure VMs are backed up using Azure Backup. Refer to the article [Manage backup and restore of Azure VMs using PowerShell](backup-azure-vms-automation.md) for details about how to back up encrypted Azure VMs.
2022
* **Configure Azure Key Vault** – Ensure that key vault to which keys and secrets need to be restored is already present. Refer to the article [Get Started with Azure Key Vault](/azure/key-vault/general/overview) for details about key vault management.
21-
* **Restore disk** - Ensure that you've triggered the restore job for restoring disks for encrypted VM using [PowerShell steps](backup-azure-vms-automation.md#restore-an-azure-vm). This is because this job generates a JSON file in your storage account containing keys and secrets for the encrypted VM to be restored.
23+
* **Restore disk** - Ensure that you trigger the restore job for restoring disks for encrypted VM using [PowerShell steps](backup-azure-vms-automation.md#restore-an-azure-vm) so that this job generates a JSON file in your storage account containing keys and secrets for the encrypted VM to be restored.
2224

2325
## Get key and secret from Azure Backup
2426

2527
> [!NOTE]
26-
> Once disk has been restored for the encrypted VM, ensure that:
28+
> Once disk is restored for the encrypted VM, ensure that:
2729
>
28-
> * $details is populated with restore disk job details, as mentioned in [PowerShell steps in Restore the Disks section](backup-azure-vms-automation.md#restore-an-azure-vm)
30+
> * $details are populated with restore disk job details, as mentioned in [PowerShell steps in Restore the Disks section](backup-azure-vms-automation.md#restore-an-azure-vm)
2931
> * VM should be created from restored disks only **after key and secret is restored to key vault**.
3032
3133
Query the restored disk properties for the job details.
@@ -48,7 +50,7 @@ $encryptionObject = Get-Content -Path $destination_path | ConvertFrom-Json
4850

4951
## Restore key
5052

51-
Once the JSON file is generated in the destination path mentioned above, generate key blob file from the JSON and feed it to restore key cmdlet to put the key (KEK) back in the key vault.
53+
Once the JSON file is generated in the mentioned destination path, generate key blob file from the JSON and feed it to restore key cmdlet to put the key (KEK) back in the key vault.
5254

5355
```powershell
5456
$keyDestination = 'C:\keyDetails.blob'
@@ -58,7 +60,7 @@ Restore-AzKeyVaultKey -VaultName '<target_key_vault_name>' -InputFile $keyDestin
5860

5961
## Restore secret
6062

61-
Use the JSON file generated above to get secret name and value and feed it to set secret cmdlet to put the secret (BEK) back in the key vault. Use these cmdlets if your **VM is encrypted using BEK and KEK**.
63+
Use the generated JSON file to get secret name and value and feed it to set secret cmdlet to put the secret - BitLocker Encryption Key (BEK) back in the key vault. Use these cmdlets if your **VM is encrypted using BEK and KEK**.
6264

6365
**Use these cmdlets if your Windows VM is encrypted using BEK and KEK.**
6466

@@ -80,7 +82,7 @@ $Tags = @{'DiskEncryptionKeyEncryptionAlgorithm' = 'RSA-OAEP';'DiskEncryptionKey
8082
Set-AzKeyVaultSecret -VaultName '<target_key_vault_name>' -Name $secretname -SecretValue $Secret -ContentType 'Wrapped BEK' -Tags $Tags
8183
```
8284

83-
Use the JSON file generated above to get secret name and value and feed it to set secret cmdlet to put the secret (BEK) back in the key vault. Use these cmdlets if your **VM is encrypted using BEK** only.
85+
Use the generated JSON file to get secret name and value and feed it to set secret cmdlet to put the secret (BEK) back in the key vault. Use these cmdlets if your **VM is encrypted using BEK** only.
8486

8587
```powershell
8688
$secretDestination = 'C:\secret.blob'
@@ -97,11 +99,11 @@ Restore-AzKeyVaultSecret -VaultName '<target_key_vault_name>' -InputFile $secret
9799
98100
## Create virtual machine from restored disk
99101

100-
If you've backed up encrypted VM using Azure VM Backup, the PowerShell cmdlets mentioned above help you restore key and secret back to the key vault. After restoring them, refer to the article [Manage backup and restore of Azure VMs using PowerShell](backup-azure-vms-automation.md#create-a-vm-from-restored-disks) to create encrypted VMs from restored disk, key, and secret.
102+
If you back up encrypted VM using Azure VM Backup, the preceding PowerShell cmdlets help you restore key and secret back to the key vault. After restoring them, refer to the article [Manage backup and restore of Azure VMs using PowerShell](backup-azure-vms-automation.md#create-a-vm-from-restored-disks) to create encrypted VMs from restored disk, key, and secret.
101103

102104
## Legacy approach
103105

104-
The approach mentioned above would work for all the recovery points. However, the older approach of getting key and secret information from recovery point, would be valid for recovery points older than July 11, 2017 for VMs encrypted using BEK and KEK. Once restore disk job is complete for encrypted VM using [PowerShell steps](backup-azure-vms-automation.md#restore-an-azure-vm), ensure that $rp is populated with a valid value.
106+
The preceding approach works for all the recovery points. However, the older approach of getting key and secret information from recovery point, would be valid for recovery points older than July 11, 2017 for VMs encrypted using BEK and KEK. Once restore disk job is complete for encrypted VM using [PowerShell steps](backup-azure-vms-automation.md#restore-an-azure-vm), ensure that $rp is populated with a valid value.
105107

106108
### Restore key (legacy approach)
107109

articles/backup/backup-azure-vms-encryption.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Back up and restore encrypted Azure VMs
33
description: Describes how to back up and restore encrypted Azure VMs with the Azure Backup service.
44
ms.topic: how-to
5-
ms.date: 05/07/2025
5+
ms.date: 08/20/2025
66
ms.service: azure-backup
77
author: AbhishekMallick-MS
88
ms.author: v-mallicka
@@ -214,3 +214,5 @@ If you run into any issues, review these articles:
214214

215215
- [Common errors](backup-azure-vms-troubleshoot.md) when backing up and restoring encrypted Azure VMs.
216216
- [Azure VM agent/backup extension](backup-azure-troubleshoot-vm-backup-fails-snapshot-timeout.md) issues.
217+
- [Restore Key Vault key and secret for encrypted VMs using Azure Backup](backup-azure-restore-key-secret.md).
218+

articles/backup/restore-azure-encrypted-virtual-machines.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Restore encrypted Azure VMs
33
description: Describes how to restore encrypted Azure VMs with the Azure Backup service.
44
ms.topic: how-to
5-
ms.date: 06/23/2025
5+
ms.date: 08/20/2025
66
author: AbhishekMallick-MS
77
ms.author: v-mallicka
88
# Customer intent: "As an IT administrator, I want to restore encrypted Azure virtual machines using the Azure Backup service, so that I can ensure data recovery while maintaining security compliance."
@@ -14,6 +14,8 @@ This article describes how to restore Windows or Linux Azure virtual machines (V
1414
> [!Note]
1515
> This article is applicable to virtual machines encrypted with Azure Disk encryption. For more information on ADE and how it differs from other disk encryption types in Azure, see [Disk Encryption Overview](/azure/virtual-machines/disk-encryption-overview).
1616
17+
You can also restore Key Vault key and secret for encrypted VMs using Azure Backup. [Learn more](backup-azure-restore-key-secret.md).
18+
1719
## Before you start
1820

1921
Review the known limitations before you start restore of an encrypted VM

0 commit comments

Comments
 (0)