Forum Discussion
How to recover VM (node) by using azure cli
Hi community,
How to recover vm (node) by using azure cli connecting from macos to linux node ?
Thanks,
Dieudonne
2 Replies
- balasubramanimIron Contributor
To recover an Azure VM (node) using Azure CLI from macOS to a Linux VM, try these steps.
1. Install Azure CLI (if not installed)
brew install azure-cli2. Login to Azure
az login3. Check VM Status
az vm show --resource-group <ResourceGroup> --name <VMName> --query "powerState" -o tsv4. Restart VM (if needed)
az vm restart --resource-group <ResourceGroup> --name <VMName>5. Start VM (if stopped)
az vm start --resource-group <ResourceGroup> --name <VMName>6. Restore VM from Snapshot (if needed)
Find the snapshot:
az snapshot list --resource-group <ResourceGroup> --output table
Create a new disk from the snapshot:
az disk create --resource-group <ResourceGroup> --name <NewDiskName> --source <SnapshotName>
Attach the new disk to the VM:
az vm disk attach --resource-group <ResourceGroup> --vm-name <VMName> --name <NewDiskName>7. Connect via SSH
ssh <username>@<vm-ip>
If your VM is still down, check logs:
az vm get-instance-view --resource-group <ResourceGroup> --name <VMName> --output jsonI hope it helps you
Take this, Azure CLI supported on macOS:
Tutorial - Restore a VM with Azure CLI - Azure Backup | Microsoft Learn