Skip to content

Commit 35d3e6a

Browse files
authored
Merge pull request #17007 from alkohli/aktvm
TVM changes
2 parents fa2c5a2 + 6a80ae4 commit 35d3e6a

6 files changed

+242
-70
lines changed

.openpublishing.redirection.azure-local.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,4 +1911,4 @@
19111911
"redirect_document_id": false
19121912
}
19131913
]
1914-
}
1914+
}

azure-local/TOC.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,11 @@ items:
275275

276276
- name: Trusted launch for Arc VMs
277277
items:
278-
- name: What is Trusted Launch for Arc VMs?
278+
- name: What is Trusted launch for Arc VMs?
279279
href: manage/trusted-launch-vm-overview.md
280-
- name: Deploy Trusted Launch for Arc VMs
281-
href: manage/trusted-launch-vm-deploy.md
282-
- name: Manage guest state protection key
280+
- name: Automatic virtual TPM state transfer
281+
href: manage/trusted-launch-automatic-state-transfer.md
282+
- name: Manual backup and recovery
283283
href: manage/trusted-launch-vm-import-key.md
284284

285285
- name: Non Arc VMs

azure-local/manage/create-arc-virtual-machines.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,33 @@ Here we create a VM that uses specific memory and processor counts on a specifie
136136
| **storage-path-id** |The associated storage path where the VM configuration and the data are saved. |
137137
| **proxy-configuration** |Use this optional parameter to configure a proxy server for your VM. For more information, see [Create a VM with proxy configured](#create-a-vm-with-proxy-configured). |
138138
139-
1. Run the following command to create a VM.
139+
1. Run the following commands to create the applicable VM.
140+
141+
**To create a Trusted launch Arc VM:**
142+
143+
1. Specify additional flags to enable secure boot, enable virtual TPM, and choose security type. Note, when you specify security type as Trusted launch, you must enable secure boot and vTPM, otherwise Trusted launch VM creation will fail.
144+
145+
```azurecli
146+
az stack-hci-vm create --name $vmName --resource-group $resource_group --admin-username $userName --admin-password $password --computer-name $computerName --image $imageName --location $location --authentication-type all --nics $nicName --custom-location $customLocationID --hardware-profile memory-mb="8192" processors="4" --storage-path-id $storagePathId --enable-secure-boot true --enable-vtpm true --security-type "TrustedLaunch"
147+
```
148+
149+
1. Once the VM is created, to verify the security type of the VM is `Trusted launch`, do the following.
150+
151+
1. Run the following cmdlet (on one of the cluster nodes) to find the owner node of the VM:
152+
153+
```azurecli
154+
Get-ClusterGroup $vmName
155+
```
156+
157+
1. Run the following cmdlet on the owner node of the VM:
158+
159+
```azurecli
160+
(Get-VM $vmName).GuestStateIsolationType
161+
```
162+
163+
1. Ensure a value of `TrustedLaunch` is returned.
164+
165+
**To create a standard Arc VM:**
140166
141167
```azurecli
142168
az stack-hci-vm create --name $vmName --resource-group $resource_group --admin-username $userName --admin-password $password --computer-name $computerName --image $imageName --location $location --authentication-type all --nics $nicName --custom-location $customLocationID --hardware-profile memory-mb="8192" processors="4" --storage-path-id $storagePathId
@@ -247,7 +273,7 @@ Follow these steps in Azure portal for your Azure Local.
247273

248274
**The Virtual machine kind** is automatically set to **Azure Local**.
249275

250-
1. **Security type** - For the security of your VM, select **Standard** or **Trusted Launch virtual machines**. For more information on what are Trusted Launch Arc virtual machines, see [What is Trusted Launch for Azure Arc Virtual Machines?](./trusted-launch-vm-overview.md).
276+
1. **Security type** - For the security of your VM, select **Standard** or **Trusted launch virtual machines**. For more information on what are Trusted launch Arc virtual machines, see [What is Trusted launch for Azure Arc Virtual Machines?](./trusted-launch-vm-overview.md).
251277

252278
1. **Storage path** - Select the storage path for your VM image. Select **Choose automatically** to have a storage path with high availability automatically selected. Select **Choose manually** to specify a storage path to store VM images and configuration files on your Azure Local. In this case, ensure that the selected storage path has sufficient storage space.
253279

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: Automatic virtual TPM state transfer for Azure Local
3+
description: Learn how automatic virtual TPM state transfer works for Azure Local.
4+
ms.topic: how-to
5+
author: alkohli
6+
ms.author: alkohli
7+
ms.service: azure-local
8+
ms.date: 02/27/2025
9+
---
10+
11+
# Automatic transfer of virtual TPM state for Trusted launch VMs on Azure Local
12+
13+
[!INCLUDE [applies-to](../includes/hci-applies-to-23h2.md)]
14+
15+
This article uses an example to illustrate the automatic transfer of virtual TPM (vTPM) state in the case of Trusted launch Arc VMs on Azure Local, even as the VM migrates or fails over to another machine in the system. This operation allows the applications that use the vTPM to function normally during VM migration or fail over.
16+
17+
18+
## Example
19+
20+
This example shows a Trusted launch Arc VM running Windows 11 guest with BitLocker encryption enabled. Here are the steps to run this example:
21+
22+
1. Create a Trusted launch Arc VM running a supported Windows 11 guest operating system (OS).
23+
24+
1. Enable BitLocker encryption for the OS volume on the Win 11 guest. Sign on to the Windows 11 guest and enable BitLocker encryption for the OS volume:
25+
26+
1. In the search box on the task bar, type "Manage BitLocker," and then select it from the list of results.
27+
28+
1. Select **Turn on BitLocker** and then follow the instructions to encrypt the OS volume (C:). BitLocker uses vTPM as a key protector for the OS volume.
29+
30+
1. Confirm the owner node of the VM.
31+
32+
```powershell
33+
Get-ClusterGroup <VM name>
34+
```
35+
36+
1. Migrate the VM to another machine in the system. Run the following PowerShell command from the machine that the VM is on.
37+
38+
```powershell
39+
Move-ClusterVirtualMachineRole -Name <VM name> -Node <destination node> -MigrationType Shutdown
40+
```
41+
42+
1. Confirm that the owner node of the VM is the specified destination node.
43+
44+
```powershell
45+
Get-ClusterGroup <VM name>
46+
```
47+
48+
1. After VM migration completes, verify if the VM is available and BitLocker is enabled.
49+
50+
1. Verify that you can sign on to the Windows 11 guest in the VM, and if BitLocker encryption for the OS volume remains enabled. If true, this confirms that the vTPM state was preserved during VM migration.
51+
52+
> [!NOTE]
53+
> If vTPM state wasn't preserved during VM migration, VM startup would result in BitLocker recovery during guest boot up. You would be prompted for the BitLocker recovery password when you attempted to sign on to the Windows 11 guest. This situation occurs because the boot measurement (stored in the vTPM) of the migrated VM on the destination node is different from that of the original VM.
54+
55+
1. Force the VM to fail over to another machine in the system.
56+
57+
1. Confirm the owner node of the VM using the following command.
58+
59+
```powershell
60+
Get-ClusterGroup <VM name>
61+
```
62+
63+
1. Use Failover Cluster Manager to stop the cluster service on the owner node as follows: Select the owner node as displayed in Failover Cluster Manager.  On the **Actions** right pane, select **More Actions** and then select **Stop Cluster Service**.
64+
65+
1. Stopping the cluster service on the owner node causes the VM to be automatically migrated to another available machine in the system. Restart the cluster service afterwards.
66+
67+
1. After failover completes, verify if the VM is available and BitLocker is enabled after failover.
68+
69+
1. Confirm that the owner node of the VM is the specified destination node.
70+
71+
```powershell
72+
Get-ClusterGroup <VM name>
73+
```
74+
75+
1. After VM failover completes, verify if the VM is available and BitLocker is enabled.
76+
77+
1. Verify that you can sign on to the Windows 11 guest in the VM, and if BitLocker encryption for the OS volume remains enabled. If true, the vTPM state was preserved during VM failover.
78+
79+
> [!NOTE]
80+
> If vTPM state wasn't preserved during VM migration, VM startup would result in BitLocker recovery during guest boot up. You would be prompted for the BitLocker recovery password when you attempted to sign on to the Windows 11 guest. This situation occurs because the boot measurement (stored in the vTPM) of the migrated VM on the destination node is different from that of the original VM.
81+
82+
83+
## Next steps
84+
85+
- [Manage Trusted launch Arc VM guest state protection key](trusted-launch-vm-import-key.md).

azure-local/manage/trusted-launch-vm-import-key.md

Lines changed: 106 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,151 @@
11
---
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.
44
author: alkohli
55
ms.author: alkohli
66
ms.topic: how-to
77
ms.service: azure-local
88
ms.reviewer: alkohli
9-
ms.date: 01/28/2025
9+
ms.date: 02/21/2025
1010
---
1111

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
1313

1414
[!INCLUDE [applies-to](../includes/hci-applies-to-23h2.md)]
1515

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.
1717

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.
1919

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.
2021

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.
2223

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.
2425

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.
2627

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
2829

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.
3031

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:
3233

33-
### 1. On the target Azure Local system
3434

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
3836

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.
4238

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.
4440

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+
```
4844
4945
1. Download the Privacy Enhanced Mail (PEM) file.
5046
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.
5480
55-
### 2. On the source Azure Local system
81+
1. Import the GSP key for the VM to the backup key vault.
5682
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+
```
5886
59-
1. Copy the PEM file from the target cluster to the source cluster.
87+
## Restore the VM
6088
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.
6290
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).
6692
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.
6895
69-
```azurepowershell
70-
mocctl.exe security login --identity --loginpath (Get-MocConfig).mocLoginYAML --cloudFqdn (Get-MocConfig).cloudFqdn
71-
```
7296
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
7498
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.
78100
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
80132
81133
Run the following commands from the target Azure Local system.
82134
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+
```
84142
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.
86145
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+
```
90149
91150
## Next steps
92151

0 commit comments

Comments
 (0)