Troubleshooting Azure Virtual Machine Boot Failure

Mount Operating System Disk Offline: Azure CLI Command

Question

You have an Azure virtual machine named VM1.

You install an application on VM1, and then restart the virtual machine.

After the restart, you get the following error message: 'Boot failure. Reboot and Select proper Boot Device or Insert Boot Media in selected Boot Device.'

You need to mount the operating system disk offline from VM1 to a temporary virtual machine to troubleshoot the issue.

Which command should you run in Azure CLI?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A

https://docs.microsoft.com/en-us/cli/azure/vm/repair?view=azure-cli-latest

The correct command to mount the operating system disk offline from VM1 to a temporary virtual machine to troubleshoot the issue in Azure CLI is D. az vm disk attach.

Explanation:

When you restart an Azure virtual machine after installing an application, the virtual machine may encounter issues that prevent it from booting correctly. In this case, you can mount the operating system disk from the affected VM to a temporary VM to troubleshoot the issue.

The az vm disk attach command in Azure CLI is used to attach a data disk or an operating system disk to a virtual machine. In this scenario, you can use this command to attach the operating system disk from VM1 to a temporary virtual machine.

To do this, follow these steps:

  1. Create a new temporary virtual machine in the same resource group as VM1.
  2. Run the following command to get the resource ID of the operating system disk attached to VM1:
sql
az vm show -n VM1 -g <resource-group-name> --query storageProfile.osDisk.managedDisk.id

This command will return the resource ID of the operating system disk attached to VM1.

  1. Run the following command to attach the operating system disk to the temporary virtual machine:
css
az vm disk attach -g <resource-group-name> --vm-name <temp-vm-name> --name <os-disk-name> --sku Premium_LRS --new

In this command, replace <resource-group-name> with the name of the resource group containing VM1, <temp-vm-name> with the name of the temporary virtual machine you created in step 1, and <os-disk-name> with the name of the operating system disk attached to VM1. The --sku Premium_LRS parameter specifies the disk SKU, and the --new parameter indicates that a new disk should be created for the temporary VM.

  1. Once the disk has been attached to the temporary virtual machine, you can connect to the temporary VM and troubleshoot the issue with the operating system disk offline.

Therefore, the correct answer is option D. az vm disk attach.