|
1 | 1 | ---
|
2 |
| -title: Manage Trusted launch Arc VM guest state protection key on Azure Local, version 23H2 |
3 |
| -description: Learn how to manage a Trusted launch Arc VM guest state protection key on Azure Local, version 23H2. |
| 2 | +title: Manage Trusted launch Arc VM guest state protection key on Azure Local |
| 3 | +description: Learn how to manage a Trusted launch Arc VM guest state protection key on Azure Local. |
4 | 4 | author: alkohli
|
5 | 5 | ms.author: alkohli
|
6 | 6 | ms.topic: how-to
|
7 | 7 | ms.service: azure-local
|
8 | 8 | ms.reviewer: alkohli
|
9 |
| -ms.date: 01/28/2025 |
| 9 | +ms.date: 02/21/2025 |
10 | 10 | ---
|
11 | 11 |
|
12 |
| -# Manage Trusted launch Arc VM guest state protection key on Azure Local |
| 12 | +# Manage backup and recovery of Trusted launch Arc VMs on Azure Local |
13 | 13 |
|
14 | 14 | [!INCLUDE [applies-to](../includes/hci-applies-to-23h2.md)]
|
15 | 15 |
|
16 |
| -This article describes how to manage a Trusted launch Arc VM guest state protection key on Azure Local. |
| 16 | +This article describes how to manually back up and restore a Trusted launch Arc VM on Azure Local. |
17 | 17 |
|
18 |
| -A VM guest state protection key is used to protect the VM guest state, like the vTPM state, while at rest in storage. It's not possible to boot up a Trusted launch Arc VM without the guest state protection key. The key is stored in a key vault in the Azure Local system where the VM is located. |
| 18 | +Unlike standard Azure Arc VMs, Trusted launch Arc VMs use a VM guest state protection (GSP) key to protect the VM guest state, including the virtual TPM (vTPM) state, while at rest. The VM GSP key is stored in a local key vault in the Azure Local system where the VM resides. |
19 | 19 |
|
| 20 | +Trusted launch Arc VMs store the VM guest state in two files, VM Guest state (VMGS) and VM Runtime state (VMRS). If the VM GSP key is lost, you can't boot up a Trusted launch Arc VM. |
20 | 21 |
|
21 |
| -## Export and import the VM |
| 22 | +It is important that you back up your Trusted launch Arc VM periodically, so you can recover your VM in the event of a data loss. To back up a Trusted launch VM, back up all the VM files, including VMGS and VMRS files. Additionally, back up the VM GSP key to a backup key vault. |
22 | 23 |
|
23 |
| -The first step is to export the VM from the source Azure Local system and then import it into the target Azure Local system. |
| 24 | +Similarly, to restore a Trusted launch Arc VM to a target Azure Local system, restore all the VM files, including VMGS and VMRS files. Additionally, restore the VM GSP key from the backup key vault to another key vault on the target Azure Local system. |
24 | 25 |
|
25 |
| -1. To export the VM from the source cluster, see [Export-VM (Hyper-V)](/powershell/module/hyper-v/export-vm). |
| 26 | +The following sections describe how you can back up the Trusted launch Arc VM and restore it in the event of a data loss. |
26 | 27 |
|
27 |
| -2. To import the VM to the target cluster, see [Import-VM (Hyper-V)](/powershell/module/hyper-v/import-vm). |
| 28 | +## Back up the VM |
28 | 29 |
|
29 |
| -## Transfer the VM guest state protection key |
| 30 | +You can use [Export-VM](/powershell/module/hyper-v/export-vm) to obtain a copy of all the VM files, including VMGS and VMRS files, for your Trusted launch Arc VM. You can then back up those VM files. |
30 | 31 |
|
31 |
| -After you have exported and then imported the VM, use the following steps to transfer the VM guest state protection key from the source Azure Local system to the target Azure Local system: |
| 32 | +Follow these steps to copy the VM GSP key from the key vault on the Azure Local system (where the VM resides) to a backup key vault on a different Azure Local system: |
32 | 33 |
|
33 |
| -### 1. On the target Azure Local system |
34 | 34 |
|
35 |
| -Run the following commands from the target Azure Local system. |
36 |
| - |
37 |
| -1. Sign into the key vault using administrative privileges. |
| 35 | +### 1. On the Azure Local system with the backup key vault |
38 | 36 |
|
39 |
| - ```azurepowershell |
40 |
| - mocctl.exe security login --identity --loginpath (Get-MocConfig).mocLoginYAML --cloudFqdn (Get-MocConfig).cloudFqdn |
41 |
| - ``` |
| 37 | +Run the following commands on the Azure Local system with the backup key vault. |
42 | 38 |
|
43 |
| -1. Create a master key in the target key vault. Run the following command. |
| 39 | +1. Create a wrapping key in the backup key vault. |
44 | 40 |
|
45 |
| - ```azurepowershell |
46 |
| - mocctl.exe security keyvault key create --location VirtualMachineLocation --group AzureStackHostAttestation --vault-name AzureStackTvmKeyVault --key-size 2048 --key-type RSA --name master |
47 |
| - ``` |
| 41 | + ```azurecli |
| 42 | + New-MocKey -name wrappingKey -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -type RSA -size 2048 |
| 43 | + ``` |
48 | 44 |
|
49 | 45 | 1. Download the Privacy Enhanced Mail (PEM) file.
|
50 | 46 |
|
51 |
| - ```azurepowershell |
52 |
| - mocctl.exe security keyvault key download --name master --file-path C:\master.pem --vault-name AzureStackTvmKeyVault |
53 |
| - ``` |
| 47 | + ```azurecli |
| 48 | + Get-MocKeyPublicKey -name wrappingKey -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -outputFile wrappingKey.pem |
| 49 | + ``` |
| 50 | +
|
| 51 | +### 2. On the Azure Local system where the VM resides |
| 52 | +
|
| 53 | +Run the following commands on the Azure Local system. |
| 54 | +
|
| 55 | +1. Copy the PEM file to the Azure Local system. |
| 56 | +
|
| 57 | +1. Confirm the owner node of the VM. |
| 58 | +
|
| 59 | + ```azurecli |
| 60 | + Get-ClusterGroup <VM name> |
| 61 | + ``` |
| 62 | +
|
| 63 | +1. Run the following cmdlet on the owner node to determine the VM ID. |
| 64 | +
|
| 65 | + ```azurecli |
| 66 | + (Get-VM -Name <VM name>).vmid |
| 67 | + ``` |
| 68 | +
|
| 69 | +1. Export the GSP key for the VM. |
| 70 | +
|
| 71 | + ```azurecli |
| 72 | + Export-MocKey -name <VM ID> -wrappingKeyName wrappingKey -wrappingPubKeyFile wrappingKey.pem -outFile <VM ID>.json -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -size 256 |
| 73 | + ``` |
| 74 | +
|
| 75 | +### 3. On the Azure Local system with the backup key vault |
| 76 | +
|
| 77 | +Run the following steps on the Azure Local system. |
| 78 | +
|
| 79 | +1. Copy the `<VM ID>` and `<VM ID>.json` file to the Azure Local system. |
54 | 80 |
|
55 |
| -### 2. On the source Azure Local system |
| 81 | +1. Import the GSP key for the VM to the backup key vault. |
56 | 82 |
|
57 |
| -Run the following commands from the source Azure Local system. |
| 83 | + ```azurecli |
| 84 | + Import-MocKey -name <VM ID> -importKeyFile <VM ID>.json -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -type AES -size 256 |
| 85 | + ``` |
58 | 86 |
|
59 |
| -1. Copy the PEM file from the target cluster to the source cluster. |
| 87 | +## Restore the VM |
60 | 88 |
|
61 |
| -1. Run the following cmdlet to determine the ID of the VM. |
| 89 | +In the event of a data loss, use the backup copy of your VM files, and restore the VM to a target Azure Local system using [Import-VM](/powershell/module/hyper-v/import-vm). This restores all the VM files, including VMGS and VMRS files. |
62 | 90 |
|
63 |
| - ```azurepowershell |
64 |
| - (Get-VM -Name <vmName>).vmid |
65 |
| - ``` |
| 91 | +Follow these steps to copy the VM GSP key from the backup key vault in the Azure Local system (where the backup copy of the VM GSP key was stored) to the key vault on the target Azure Local system (where the VM needs to be restored). |
66 | 92 |
|
67 |
| -1. Sign into the key vault using administrative privileges. |
| 93 | +> [!NOTE] |
| 94 | +> Trusted launch Arc VMs restored on an alternate Azure Local system (different from the Azure Local system where the VM originally resided) can't be managed from the Azure control plane. |
68 | 95 |
|
69 |
| - ```azurepowershell |
70 |
| - mocctl.exe security login --identity --loginpath (Get-MocConfig).mocLoginYAML --cloudFqdn (Get-MocConfig).cloudFqdn |
71 |
| - ``` |
72 | 96 |
|
73 |
| -1. Export the VM guest state protection key for the VM. |
| 97 | +### 1. On the source Azure Local system where the VM needs to be restored |
74 | 98 |
|
75 |
| - ```azurepowershell |
76 |
| - mocctl.exe security keyvault key export --vault-name AzureStackTvmKeyVault --name <vmID> --wrapping-pub-key-file C:\master.pem --out-file C:\<vmID>.json |
77 |
| - ``` |
| 99 | +Run the following commands on the Azure Local system. |
78 | 100 |
|
79 |
| -### 3. On the target Azure Local system |
| 101 | +1. Create a wrapping key in the key vault. |
| 102 | +
|
| 103 | + ```azurecli |
| 104 | + New-MocKey -name wrappingKey -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -type RSA -size 2048 |
| 105 | + ``` |
| 106 | +
|
| 107 | +1. Download the Privacy Enhanced Mail (PEM) file. |
| 108 | +
|
| 109 | + ```azurecli |
| 110 | + Get-MocKeyPublicKey -name wrappingKey -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -outputFile wrappingKey.pem |
| 111 | + ``` |
| 112 | +
|
| 113 | +### 2. On the Azure Local system with the backup key vault |
| 114 | +
|
| 115 | +Run the following commands on the Azure Local system. |
| 116 | +
|
| 117 | +1. Copy the PEM file to the Azure Local system. |
| 118 | +
|
| 119 | +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. |
| 120 | +
|
| 121 | + ```azurecli |
| 122 | + (Get-VM -Name <VM name>).vmid |
| 123 | + ``` |
| 124 | +
|
| 125 | +1. Export the VM GSP key for the VM. |
| 126 | +
|
| 127 | + ```azurecli |
| 128 | + Export-MocKey -name <VM ID> -wrappingKeyName wrappingKey -wrappingPubKeyFile wrappingKey.pem -outFile <VM ID>.json -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -size 256 |
| 129 | + ``` |
| 130 | +
|
| 131 | +### 3. On the Azure Local system where the VM needs to be restored |
80 | 132 |
|
81 | 133 | Run the following commands from the target Azure Local system.
|
82 | 134 |
|
83 |
| -1. Copy the `vmID` and `vmID.json` file from the source cluster to the target cluster. |
| 135 | +1. Copy the `<VM ID>` and `<VM ID>.json` file to the Azure Local system. |
| 136 | +
|
| 137 | +1. Import the VM GSP key for the VM. |
| 138 | +
|
| 139 | + ```azurecli |
| 140 | + Import-MocKey -name <VM ID> -importKeyFile <VM ID>.json -group AzureStackHostAttestation -keyvaultName AzureStackTvmKeyVault -type AES -size 256 |
| 141 | + ``` |
84 | 142 |
|
85 |
| -1. Import the VM guest state protection key for the VM. |
| 143 | + > [!NOTE] |
| 144 | + > Restore the VM GSP key (complete the steps above) before you start the VM on the Azure Local system (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. |
86 | 145 |
|
87 |
| - ```azurepowershell |
88 |
| - mocctl.exe security keyvault key import --key-file-path C:\<vmID>.json --name <vmID> --vault-name AzureStackTvmKeyVault --wrapping-key-name master --key-type AES --key-size 256 |
89 |
| - ``` |
| 146 | + ```azurecli |
| 147 | + Remove-MocKey -name <vm id> -group AzureStackHostAttestation -keyvaultName > AzureStackTvmKeyVault |
| 148 | + ``` |
90 | 149 |
|
91 | 150 | ## Next steps
|
92 | 151 |
|
|
0 commit comments