You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can backup and restore the VM guest state protection key of each Trusted launch VM on an Azure Local instance using one of the following approaches.
16
+
You can backup and restore the virtual machine (VM) guest state protection key of each Trusted launch VM on an Azure Local instance using one of the following methods.
17
17
18
-
**Approach 1** (recommended): Backup/restore VM guest state protection keys to/from a file system folder. You can use this approach starting with Azure Local 2505 release and onwards. If your Azure Local instance uses an earlier Azure Local release, you can instead use approach 2.
18
+
-**Azure Local release 2505 and later**: Backup/restore VM guest state protection keys to/from a file system folder.
19
19
20
-
**Approach 2**: Backup/restore VM guest state protection keys to/from a key vault in another Azure Local instance. Use this approach only if your Azure Local instance uses an earlier Azure Local release earlier than 2505.
20
+
-**Azure Local releases prior to 2505**: Backup/restore VM guest state protection keys to/from a key vault in another Azure Local instance.
21
21
22
-
## Backup and restore VM guest state protection keys using file system folder
22
+
## For Azure Local release 2505 and later
23
23
24
-
To backup, this approach copies VM guest state protection keys from the local key vault of your Azure Local instance to a folder that is backed up periodically.
24
+
To backup, this approach copies VM guest state protection keys from the local key vault of your Azure Local instance to a folder that is backed up periodically. The VM guest state protection keys stored inside that folder are in an encrypted form.
25
25
26
-
To restore, this approach restores VM guest state protection keys from a folder (containing the backup copy) to the local key vault of an Azure Local instance where the VMs need to be restored.
26
+
To restore, this approach restores VM guest state protection keys from a folder (containing the backup copy) to the local key vault of an Azure Local instance where the VMs need to be restored.
27
27
28
28
### Backup
29
29
30
30
The steps below involve copying VM guest state protection keys from the local key vault of your Azure Local instance to a folder that is backed up periodically.
31
31
32
32
> [!NOTE]
33
-
> You can only use this approach starting with Azure Local 2505 release and onwards. If your Azure Local instance uses an earlier Azure Local release, you can instead use approach 2.
33
+
> You can only use this method for Azure Local 2505 release and later. If your Azure Local instance uses an earlier Azure Local release, use the other method.
34
34
35
-
1. On a secure computer using PowerShell 7, generate a wrapping key:
35
+
1. On a secure computer using PowerShell 7, generate a wrapping key of size 2048:
1. Copy the `.\public.pem` file to your Azure Local instance.
50
50
51
51
1. Copy VM guest state protection keys from the local key vault of your Azure Local instance to a folder that is backed up periodically:
52
52
53
-
1. Download `TvmBackupUtils.psm1` script file on GitHub repo `Azure-Samples/AzureLocal` to your Azure Local instance.
53
+
1. Download the `TvmBackupUtils.psm1` script file located on GitHub (link to repo path) to your Azure Local instance.
54
54
55
55
1. Run `import-module .\TvmBackupUtils.psm1 -force`.
56
56
57
-
1. Run `Backup-TVMKeys -WrappingKeyPath <path to public.pem> -BackupRootPath` (path to backup root folder where the timestamped backup folder will be stored).
57
+
1. Run `Backup-TVMKeys -WrappingKeyPath <path to public.pem> -BackupRootPath <path to backup root folder where the timestamped backup folder is stored>`.
58
58
59
-
1. Make note of the timestamped backup folder created under the backup root folder. You will need this later during recovery.
59
+
1. Make note of the timestamped backup folder created under the backup root folder. You will need this later during recovery. For examople, backup folder named "20250612205355" with the format "yyyyMMddHHmmss".
60
60
61
-
1. Make sure to periodically backup the backup root folder.
61
+
1. Periodically backup the backup root folder.
62
62
63
63
### Restore
64
64
65
-
The steps below involve restoring VM guest state protection keys from a folder (containing the backup copy) to the local key vault of an Azure Local instance where the VMs need to be restored.
65
+
The steps below involve restoring VM guest state protection keys from a folder containing the backup copy to the local key vault of an Azure Local instance where the VMs need to be restored.
66
66
67
-
> [!NOTE]
68
-
> You can only use this approach starting Azure Local 2505 release and onwards. If your Azure Local instance is on an earlier Azure Local release, you can instead use approach 2.
69
-
70
-
1. Copy both private and public key files for the wrapping key (which you had created during backup step 1) to the Azure Local instance.
67
+
1. Copy both private and public key files for the wrapping key that you created during step 1 for Backup to the Azure Local instance.
71
68
72
-
1. Copy the timestamped backup folder to the Azure Local instance. Pick the folder (under the backup root folder) with the latest timestamp as that folder will have the most recent copy.
69
+
1. Copy the timestamped backup folder to the Azure Local instance. Pick the folder under the backup root folder with the latest timestamp as that folder will have the most recent copy.
73
70
74
71
> [!NOTE]
75
72
>Don't modify the backup folder.
76
73
77
-
1. Import the wrapping key (which you had created during backup step 1) to the Azure Local instance:
74
+
1. Import the wrapping key that you created during backup step 1 for Backup to the Azure Local instance:
78
75
79
-
1. Download the `TvmBackupUtils.psm1` script file (link to file on GitHub repo Azure-Samples/AzureLocal: Contains scripts, code samples, for Azure Stack HCI) to your Azure Local instance.
76
+
1. Download the `TvmBackupUtils.psm1` script file on Github at (link to file on GitHub repo Azure-Samples/AzureLocal: Contains scripts, code samples, for Azure Stack HCI) to your Azure Local instance.
80
77
81
78
1. Run `Import-Module .\TvmBackupUtils.psm1 -force`.
82
79
83
80
> [!NOTE]
84
-
> Make sure the WrappingKeyName you specify does not match the name of a key already existing in the backup (timestamped backup folder). Otherwise, this will cause a failure during import (restore step 4).
81
+
> Make sure the WrappingKeyName you specify doesn't match the name of a key already existing in the timestamped backup folder. Otherwise, this will cause a failure during import (see Restore step 5).
85
82
86
-
1. Run `Import-TvmWrappingKeyFromPem -KeyName <WrappingKeyName> -PublicKeyPath <path to public.pem> -PrivateKeyPath <path to private.pem> -KeySize <size of key generated 2048>`
83
+
1. Run `Import-TvmWrappingKeyFromPem -KeyName <WrappingKeyName> -PublicKeyPath <path to public.pem> -PrivateKeyPath <path to private.pem> -KeySize 2048`
84
+
85
+
1. Delete `AzureStackTvmAKRootKey`:
86
+
87
+
> [!NOTE]
88
+
> Do this step only if you're restoring the VM to the same Azure Local instance (the Azure Local instance where the VM resided before failure).
`Import-TVMKeys -WrappingKeyName <WrappingKeyName> -BackupPath <path to timestamped backup folder>`.
94
+
`Import-TVMKeys -WrappingKeyName <WrappingKeyName> -BackupPath <path to timestamped backup folder>`.
91
95
92
96
> [NOTE!]
93
-
> If the local key vault of the Azure Local instance already has a VM guest state protection key with the same name, you will receive an InvalidVersion error for that key. You can ignore this, as the key is already in the key vault.
97
+
> If the local key vault of the Azure Local instance already has a VM guest state protection key with the same name or already has an `AzureStackTvmAKRootKey`, you will receive an `InvalidVersion` error for that key. You can ignore this, as the key is already in the key vault.
94
98
95
-
1. Cleanup files and keys
99
+
1. Cleanup files and keys:
96
100
97
-
1. Delete both public.pem and private.pem files from the Azure Local instance.
101
+
1. Delete both `public.pem` and `private.pem` files from the Azure Local instance.
98
102
99
103
> [!IMPORTANT]
100
-
> Remove the wrapping key from the local key vault of the Azure Local instance using Remove-MocKey. This will help avoid collisions later.
104
+
> Remove the wrapping key from the local key vault of the Azure Local instance using `Remove-MocKey`. This will help avoid collisions later.
101
105
102
106
1. Run `Remove-MocKey -name WrappingKeyName -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault`.
103
107
104
-
> [!NOTE]
105
-
> You should start a VM on the Azure Local instance only after you have successfully restored both its VM files and its VM guest state protection key. If you had inadvertently attempted to start a VM before restoring its VM guest state protection key, you must delete the AzureStackTvmAKRootKey (which would have been auto generated) from the local key vault of the Azure Local instance.
106
-
107
-
1. Run `Remove-MocKey -name AzureStackTvmAKRootKey -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault`.
108
108
109
-
## Backup or restore VM guest state protection keys via a key vault in another Azure Local instance
109
+
## For Azure Local releases prior to 2505
110
110
111
-
To backup, this approach copies VM guest state protection keys from the local key vault of your Azure Local instance to the local key vault (backup key vault) of another Azure Local instance (which is used for key backup purposes).
111
+
To backup, this approach copies VM guest state protection keys from the local key vault of your Azure Local instance to the local key vault of another Azure Local instance that is used for key backup purposes.
112
112
113
-
To restore, this approach restores VM guest state protection keys from the local key vault (backup key vault) of the Azure Local instance (which is used for key backup purposes) to the local key vault of an Azure Local instance where the VMs need to be restored.
113
+
To restore, this method restores VM guest state protection keys from the local key vault (backup key vault) of the Azure Local instance that is used for key backup purposes to the local key vault of an Azure Local instance where the VMs need to be restored.
114
114
115
115
### Backup
116
116
117
-
Follow these steps to copy the VM guest state protection key from the local key vault of the Azure Local instance (where the VM resides) to a backup key vault on another Azure Local instance:
117
+
Follow these steps to copy the VM guest state protection key from the local key vault of the Azure Local instance where the VM resides to a backup key vault on another Azure Local instance:
118
118
119
119
1. On the Azure Local system with the backup key vault, run the following commands on the Azure Local system with the backup key vault:
120
120
@@ -124,55 +124,55 @@ Follow these steps to copy the VM guest state protection key from the local key
Follow these steps to copy the VM guest state protection key from the backup key vault of the Azure Local instance (which was used for key backup purposes) to the local key vault of the target Azure Local system (where the VM needs to be restored):
155
+
Follow these steps to copy the VM guest state protection key from the backup key vault of the Azure Local instance that is used for key backup purposes to the local key vault of the target Azure Local system where the VM needs to be restored:
156
156
157
157
1. On the source Azure Local system where the VM needs to be restored, run the following commands on the Azure Local system:
1. On the Azure Local system with the backup key vault, run the following commands on the Azure Local system.
167
+
1. On the Azure Local system with the backup key vault, run the following commands on the Azure Local system.
168
168
169
-
1. Copy the PEM file to the Azure Local system.
169
+
1. Copy the PEM file to the Azure Local system.
170
170
171
-
1. Get the `VM ID` from the VM files stored on disk (wherever this is located). There will be a VM config file (.xml) that has the `VM ID` as its name. You can also use the following command to obtain the `VM ID` if you know the VM name. You need to do this step on a Hyper-V host that has the VM files.
171
+
1. Get the `VM ID` from the VM files stored on disk. There will be a VM config file (.xml) that has the `VM ID` as its name. You can also use the following command to obtain the `VM ID` if you know the VM name. Perform this step on a Hyper-V host that has the VM files:
> Restore the VM guest state key (complete the steps above) before you start the VM on the Azure Local instance (where the VM needs to be restored). This ensures that the VM uses the restored VM GSP key. Otherwise, the VM creation fails, and a new VM GSP key is created by the system. If this happens by mistake (human error), delete the VM GSP key and then repeat the steps to restore the VM GSP key.
188
+
> Restore the VM guest state key (complete the steps above) before you start the VM on the Azure Local instance where the VM needs to be restored. This ensures that the VM uses the restored VM GSP key. Otherwise, the VM creation fails, and a new VM GSP key is created by the system. If this happens by mistake (human error), delete the VM GSP key and then repeat the steps to restore the VM GSP key.
0 commit comments