$ az vm repair create -g labnestedvm -n nestedvm --repair-username azureuser --repair-password 'password!234' --enable-nested --verbose
Does repair vm requires public ip? (y/n): y
Fetching architecture type of the source VM...
Fetching compatible Windows OS images from gallery...
Fetching available VM sizes for repair VM...
VM size 'Standard_D2s_v3' is available. Using it to create repair VM.
Checking for existing resource groups with identical name within subscription...
Pre-existing repair resource group with the same name is 'False'
Creating resource group for repair VM and its resources...
Source VM uses managed disks. Creating repair VM with managed disks.
Copying OS disk of source VM...
Creating repair VM with command: az vm create -g repair-nestedvm-20240119062313 -n repair-nestedv_ --tag repair_source=labnestedvm/nestedvm --image MicrosoftWindowsServer:WindowsServer:2016-Datacenter:2016.127.20190416 --admin-username azureuser --admin-password password!234 --public-ip-address repair-nestedv_PublicIP --size Standard_D2s_v3
copy_disk_id: /subscriptions/93b7ca88-d2cc-4381-97ec-f99f3a702495/resourceGroups/labnestedvm/providers/Microsoft.Compute/disks/nestedvm-DiskCopy-20240119062313
repair_password: password!234
repair_username: azureuser
fix_uuid: False
Validating VM template before continuing...
Creating repair VM...
Running Script win-enable-nested-hyperv.ps1 to install HyperV
Your repair VM 'repair-nestedv_' has been created in the resource group 'repair-nestedvm-20240119062313' with disk 'nestedvm-DiskCopy-20240119062313' attached as data disk. Please use this VM to troubleshoot and repair. Once the repairs are complete use the command 'az vm repair restore -n nestedvm -g labnestedvm --verbose' to restore disk to the source VM. Note that the copied disk is created within the original resource group 'labnestedvm'.
{
"copied_disk_name": "nestedvm-DiskCopy-20240119062313",
"copied_disk_uri": "/subscriptions/xxx/resourceGroups/labnestedvm/providers/Microsoft.Compute/disks/nestedvm-DiskCopy-20240119062313",
"created_resources": [
"/subscriptions/xxx/resourceGroups/repair-nestedvm-20240119062313/providers/Microsoft.Network/networkInterfaces/repair-nestedv_VMNic",
"/subscriptions/xxx/resourceGroups/REPAIR-NESTEDVM-20240119062313/providers/Microsoft.Compute/disks/repair-nestedv__disk1_5a57aca448c04a1083bfa06ea0e7d7a6",
"/subscriptions/xxxresourceGroups/repair-nestedvm-20240119062313/providers/Microsoft.Network/publicIPAddresses/repair-nestedv_PublicIP",
"/subscriptions/xxx/resourceGroups/repair-nestedvm-20240119062313/providers/Microsoft.Network/networkSecurityGroups/repair-nestedv_NSG",
"/subscriptions/xxx/resourceGroups/repair-nestedvm-20240119062313/providers/Microsoft.Network/virtualNetworks/repair-nestedv_VNET",
"/subscriptions/xxx/resourceGroups/repair-nestedvm-20240119062313/providers/Microsoft.Compute/virtualMachines/repair-nestedv_",
"/subscriptions/xxx/resourceGroups/labnestedvm/providers/Microsoft.Compute/disks/nestedvm-DiskCopy-20240119062313"
],
"message": "Your repair VM 'repair-nestedv_' has been created in the resource group 'repair-nestedvm-20240119062313' with disk 'nestedvm-DiskCopy-20240119062313' attached as data disk. Please use this VM to troubleshoot and repair. Once the repairs are complete use the command 'az vm repair restore -n nestedvm -g labnestedvm --verbose' to restore disk to the source VM. Note that the copied disk is created within the original resource group 'labnestedvm'.",
"repair_resource_group": "repair-nestedvm-20240119062313",
"repair_vm_name": "repair-nestedv_",
"resource_tag": "repair_source=labnestedvm/nestedvm",
"status": "SUCCESS"
}
Command ran in 346.562 seconds (init: 0.206, invoke: 346.355)
yuri@Azure:~$
I believe "az vm repair run" will be executed via custom script, but I confirm there is no event.
$ az group create -n labnestedvm -l japaneast
$ az vm create -g labnestedvm --name nestedvm --image Win2022AzureEditionCore --admin-username azureuser --public-ip-address ""
$ az extension add -n vm-repair
$ az vm repair create -g labnestedvm -n nestedvm --repair-username azureuser --repair-password 'password!234' --enable-nested --verbose
Errors
No error. From debug log, enabling Hyper-V could be skipped.
Running Script win-enable-nested-hyperv.ps1 to install HyperV
Your repair VM 'repair-nestedv_' has been created in the resource group 'repair-nestedvm-20240119062313' with disk 'nestedvm-DiskCopy-20240119062313' attached as data disk. Please use this VM to troubleshoot and repair. Once the repairs are complete use the command 'az vm repair restore -n nestedvm -g labnestedvm --verbose' to restore disk to the source VM. Note that the copied disk is created within the original resource group 'labnestedvm'.
If you need to troubleshoot your VM in a nested Hyper-V environment, use --enable-nested and the repair VM will created with the Hyper-V role enabled along with a nested VM using the OS disk copy.
Environment Summary
$ az version
{
"azure-cli": "2.56.0",
"azure-cli-core": "2.56.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"vm-repair": "1.0.0b1"
}
}
Describe the bug
It is possible to create repair VM but Hyper-V is not enabled. I see https://github.com/Azure/azure-cli-extensions/issues/7177 (the result is slightly different).
I believe "az vm repair run" will be executed via custom script, but I confirm there is no event.
https://github.com/Azure/azure-cli-extensions/blob/cf183a48b210ff6e7b33af806d4604d9d8c25fdd/src/vm-repair/azext_vm_repair/custom.py#L219-L244
Related command
How to reproduce.
Errors
No error. From debug log, enabling Hyper-V could be skipped.
Running Script win-enable-nested-hyperv.ps1 to install HyperV
Your repair VM 'repair-nestedv_' has been created in the resource group 'repair-nestedvm-20240119062313' with disk 'nestedvm-DiskCopy-20240119062313' attached as data disk. Please use this VM to troubleshoot and repair. Once the repairs are complete use the command 'az vm repair restore -n nestedvm -g labnestedvm --verbose' to restore disk to the source VM. Note that the copied disk is created within the original resource group 'labnestedvm'.
Issue script & Debug output
Please see entire debug log at "Describe the bug"
Expected behavior
Enabled Hyper-V described in below document.
https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example
If you need to troubleshoot your VM in a nested Hyper-V environment, use --enable-nested and the repair VM will created with the Hyper-V role enabled along with a nested VM using the OS disk copy.
Environment Summary
$ az version { "azure-cli": "2.56.0", "azure-cli-core": "2.56.0", "azure-cli-telemetry": "1.1.0", "extensions": { "vm-repair": "1.0.0b1" } }
Same in Azure Cloud Shell
Additional context
No response