| title | Virtual machine stuck in failed state |
|---|---|
| description | Resolves issues in which a virtual machine (VM) is stuck in a failed state. |
| services | virtual-machines |
| author | mimckitt |
| manager | dcscontentpm |
| tags | azure-resource-manager |
| ms.service | azure-virtual-machines |
| ms.topic | troubleshooting |
| ms.date | 03/26/2024 |
| ms.author | mimckitt |
| ms.custom | sap:VM Admin - Windows (Guest OS) |
Applies to: ✔️ Linux VMs ✔️ Windows VMs
This article provides steps to resolve issues in which a Microsoft Azure virtual machine (VM) is stuck in a failed state.
The VM status in the Azure portal is shown as Failed.
The last operation that was run on the VM failed after the input was accepted.
Note
This resolution is supported only for API version "2019-07-01" or a later version.
Update the VM objects and properties by running the reapply command in the Azure portal:
- Navigate to the VM that's stuck in the Failed state.
- Under Support + troubleshooting, select Redeploy + reapply.
- Select the Reapply option.
:::image type="content" source="./media/troubleshoot-vm-reapply/vm-reapply-portal.png" alt-text="Screenshot of the region options that shows the difference in pricing and eviction rates as a table.":::
Update the VM objects and properties by running the az vm reapply command:
az vm reapply -g MyResourceGroup -n MyVm
Update the VM objects and properties by running the Update-AzVM command after you apply the reapply parameter:
Get-AzVM -ResourceGroupName <ResourceGroup> -Name <VMName>
Set-AzVM -ResourceGroupName <ResourceGroup> -Name <VMName> -Reapply
Update-AzVM -VM <PSVirtualMachine> -ResourceGroupName <ResourceGroupName>
Update the VM objects and properties by running the reapply command:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply?api-version=2021-07-01If reapply doesn't clear the VM Failed state, try redeploying to a new host node.