Home / Azure

Azure Local | HomeLab – Restore VM

Azure Local | HomeLab – Restore VM


Reading Time: 6 minutes

When you run virtual machines on Azure Local, you quickly realize that a VM is not just a VM. It exists as two distinct entities: the actual Hyper-V compute workload running on your cluster nodes, and an Arc object, a projection of that VM into Azure Resource Manager. Backup solutions like Azure Backup (via MABS) and Veeam do an excellent job of protecting the first half. The second half? That is where things get complicated.

This post walks through exactly what happens to your Arc VM object when a restore is performed, why Microsoft does not support ReHydration, and how you can manually recover the full Azure Local managed VM experience after a restore, including all the CLI commands you need to get there.

The Architecture: Why Two Objects Exist

To understand the problem, you first need to understand how Azure Local manages virtual machines.

When you deploy a VM through the Azure portal or via az stack-hci-vm create, two things happen simultaneously:

  1. The Hyper-V VM is created on your cluster via the underlying compute fabric.
  2. An Arc VM object (Microsoft.AzureStackHCI/virtualMachines) is registered in Azure Resource Manager through the Arc Resource Bridge (ARB) and the Azure Local cluster extension.

The Arc Resource Bridge acts as a local control plane agent, it runs as a VM on your cluster and is responsible for keeping Azure aware of your on-premises resources. It projects your VMs, virtual hard disks, and storage paths into ARM as first-class objects.

Azure Portal / ARM
        │
        │  Arc VM Object (Microsoft.AzureStackHCI/virtualMachines)
        │
Arc Resource Bridge  ──────────────────────────────────────
        │
        │  Hyper-V VM (running on cluster node)
        │
Azure Local Cluster (Node1, Node2, ...)

When you back up a VM and later restore it using Azure Backup or Veeam, only the Hyper-V layer is restored. The backup agent has no knowledge of ARM objects, Arc projections, or the Resource Bridge. The result: your VM is running on the cluster, but Azure has no idea it exists.

What Microsoft Says About ReHydration

As of today, ReHydration of Arc VM objects is not supported by Microsoft. This means there is no native, out-of-the-box mechanism to take a restored Hyper-V VM and automatically re-project it back into Azure as an Azure Local managed VM.

This is a known gap. You can vote for this feature on the Azure Feedback portal, but in the meantime, you need to handle the re-registration process manually. This post shows you exactly how.

Recovery Options

There are three approaches, depending on how complete you want the recovery to be.

Option 1 – Arc-Enabled Server (Quick, but Limited)

This gets the VM connected to Arc as a generic server, not as a managed Azure Local VM. You lose Azure Local-native lifecycle management (portal control, ARM templates, az stack-hci-vm commands), but you do get Arc connectivity, policies, extensions, and monitoring back quickly.

Log in to the restored VM and run:

# Download and install the Arc Connected Machine agent
Invoke-WebRequest -Uri https://aka.ms/azcmagent-windows `
  -OutFile "$env:TEMP\install_windows_azcmagent.ps1"

& "$env:TEMP\install_windows_azcmagent.ps1"

# Connect the machine to Arc
azcmagent connect `
  --resource-group "rg-azurelocal-prod" `
  --tenant-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" `
  --location "westeurope" `
  --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

This registers the VM as a Microsoft.HybridCompute/machines object — useful, but not the same as a full Azure Local managed VM.

Option 2 – Full Recovery as Azure Local Managed VM (Recommended)

This is the complete recovery path. It restores the VM as a proper Microsoft.AzureStackHCI/virtualMachines object, fully manageable from the portal and CLI. It requires a few more steps, but gives you back everything.

Step 1 — Restore the VM (do not power it on yet)

Run your restore through Azure Backup or Veeam as normal. Let the VHDX land on your Cluster Shared Volume. Do not power on the VM yet, you want the disk available but not in use.

After the restore, note the full VHDX path on your CSV. It will look something like:

C:\ClusterStorage\Volume01\Restored-VM\OsDisk.vhdx

Step 2 — Get Your Storage Container ID

Azure Local manages storage paths as Storage Containers (Microsoft.AzureStackHCI/storageContainers). Your restored VHDX needs to be registered under one of these.

az resource list \
  --resource-type "Microsoft.AzureStackHCI/storageContainers" \
  --resource-group "rg-azurelocal-prod" \
  --query "[].{Name:name, ID:id, Path:properties.path}" \
  -o table

This returns something like:

NameIDPath
UserStorage1/subscriptions/<sub>/resourceGroups/rg-azurelocal-prod/providers/Microsoft.AzureStackHCI/storageContainers/UserStorage1C:\ClusterStorage\Volume01\

Copy the full ID value, you will need it in the next step.

Step 3 — Get Your Custom Location ID

All Azure Local resources are scoped to a Custom Location, which maps your cluster to an Azure region. Retrieve it with:

az stack-hci-vm disk create \
  --name "restored-vm-osdisk" \
  --resource-group "rg-azurelocal-prod" \
  --custom-location "/subscriptions/<sub>/resourceGroups/rg-azurelocal-prod/providers/microsoft.extendedlocation/customlocations/<custom-location-name>" \
  --location "westeurope" \
  --storage-path-id "/subscriptions/<sub>/resourceGroups/rg-azurelocal-prod/providers/Microsoft.AzureStackHCI/storageContainers/UserStorage1" \
  --source "C:\ClusterStorage\Volume01\Restored-VM\OsDisk.vhdx"

Important: The --source parameter must point to the exact file path as it exists on your cluster storage. This does not copy or move the file, it simply registers the existing VHDX as an Arc-managed virtual disk object.

Verify the disk was registered successfully:

az stack-hci-vm disk show \
  --name "restored-vm-osdisk" \
  --resource-group "rg-azurelocal-prod" \
  --query "{Name:name, ID:id, ProvisioningState:properties.provisioningState}" \
  -o json

Expected output:

{
  "Name": "restored-vm-osdisk",
  "ID": "/subscriptions/<sub>/resourceGroups/rg-azurelocal-prod/providers/Microsoft.AzureStackHCI/virtualHardDisks/restored-vm-osdisk",
  "ProvisioningState": "Succeeded"
}

Step 5 — Retrieve the Disk ID

DISK_ID=$(az stack-hci-vm disk show \
  --name "restored-vm-osdisk" \
  --resource-group "rg-azurelocal-prod" \
  --query "id" -o tsv)

echo $DISK_ID

Step 6 — Create the Arc VM Object

Now create the Arc VM wrapper, pointing to the existing registered disk:

az stack-hci-vm create \
  --name "restored-vm-01" \
  --resource-group "rg-azurelocal-prod" \
  --custom-location "/subscriptions/<sub>/resourceGroups/rg-azurelocal-prod/providers/microsoft.extendedlocation/customlocations/<custom-location-name>" \
  --location "westeurope" \
  --os-disk-id "$DISK_ID" \
  --nics "your-nic-name"

If the VM had multiple data disks, add them with --data-disk-ids followed by a space-separated list of registered disk IDs.

Once provisioning completes, the VM will appear in the Azure portal under your resource group as a fully managed Azure Local virtual machine.

Step 7 — Power On via Azure Local

Start the VM through the portal or CLI, do not start it directly from Hyper-V Manager, as this bypasses the Arc management plane:

az stack-hci-vm start \
  --name "restored-vm-01" \
  --resource-group "rg-azurelocal-prod"

Option 3 — Prevention: Export Arc VM Metadata Before Disaster

The cleanest recovery always starts before the disaster. As part of your VM lifecycle management, export and store the ARM definition of each VM alongside your backup jobs:

az stack-hci-vm show \
  --name "your-vm-name" \
  --resource-group "rg-azurelocal-prod" \
  > backup/arc-definitions/your-vm-name-arc.json

Store this JSON file in a location that survives a VM loss, Azure Blob Storage, a Git repository, or alongside your backup metadata in the Recovery Services Vault.

A simple PowerShell script to export all VMs in a resource group:

$rg = "rg-azurelocal-prod"
$outputPath = "C:\ArcVMBackups\"

$vms = az resource list `
  --resource-type "Microsoft.AzureStackHCI/virtualMachines" `
  --resource-group $rg `
  --query "[].name" -o tsv

foreach ($vm in $vms) {
    $definition = az stack-hci-vm show `
        --name $vm `
        --resource-group $rg

    $filePath = Join-Path $outputPath "$vm-arc-definition.json"
    $definition | Out-File -FilePath $filePath -Encoding utf8
    Write-Host "Exported Arc definition for: $vm -> $filePath"
}

Schedule this script to run weekly as a Scheduled Task on your management machine.

What About Data Disks?

If your VM had additional data disks, each one needs to be registered separately before creating the VM wrapper. List all VHDXs on your CSV that belong to the restored VM, then register each:

# Register each data disk
az stack-hci-vm disk create \
  --name "restored-vm-datadisk-01" \
  --resource-group "rg-azurelocal-prod" \
  --custom-location "<custom-location-id>" \
  --location "westeurope" \
  --storage-path-id "<storage-container-id>" \
  --source "C:\ClusterStorage\Volume01\Restored-VM\DataDisk01.vhdx"

# Get data disk ID
DATA_DISK_ID=$(az stack-hci-vm disk show \
  --name "restored-vm-datadisk-01" \
  --resource-group "rg-azurelocal-prod" \
  --query "id" -o tsv)

# Include in VM create
az stack-hci-vm create \
  --name "restored-vm-01" \
  --resource-group "rg-azurelocal-prod" \
  --custom-location "<custom-location-id>" \
  --location "westeurope" \
  --os-disk-id "$DISK_ID" \
  --data-disk-ids "$DATA_DISK_ID"

Conclusion

The lack of ReHydration support in Azure Local is a real operational gap that catches many administrators off guard, typically during an actual incident, which is the worst possible time to discover it. The root cause is straightforward: backup tools protect the Hyper-V layer, not the Arc projection layer.

The good news is that the recovery is fully achievable manually. By re-registering the restored VHDX as an Arc virtualHardDisk object and re-creating the Arc VM wrapper, you can bring the VM back as a fully Azure Local managed machine, not just a dangling Hyper-V VM.

The even better news: with a simple weekly export of your Arc VM definitions and a documented runbook, you can turn what would otherwise be a stressful multi-hour recovery into a reliable, repeatable procedure.

Recovery OptionResultEffort
azcmagent registration onlyArc-enabled serverLow
Re-register disk + re-create VM wrapperFull Azure Local managed VMMedium
Pre-exported Arc definition + re-createFull Azure Local managed VM (fastest)Low (with prep)

Take the time to export your Arc definitions today. Your future self will thank you.

Share and Enjoy !

Shares

Designer (23)

Stay close to the action—follow GetToThe.Cloud across social!
Deep dives and hands‑on how‑tos on Azure Local, hybrid cloud, automation, PowerShell/Bicep, AVD + FSLogix, image pipelines, monitoring, networking, and resilient design when the internet/Azure is down.

🔗 Our channels
▶️ YouTube: https://www.youtube.com/channel/UCa33PgGdXt-Dr4w3Ub9hrdQ
💼 LinkedIn Group: https://www.linkedin.com/groups/9181126/
✖️ X (Twitter): https://x.com/Gettothecloud
🎵 TikTok: https://www.tiktok.com/@gettothecloud
🐙 GitHub: https://github.com/GetToThe-Cloud/Website
💬 Slack: DM us for an invite
📲 WhatsApp: DM for the community link

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners. View more
Cookies settings
Accept
Privacy & Cookie policy
Privacy & Cookies policy
Cookie name Active

Who we are

Our website address is: https://www.gettothe.cloud

Comments

When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

Media

If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

Cookies

If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed.If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

Embedded content from other websites

Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

Who we share your data with

If you request a password reset, your IP address will be included in the reset email.

How long we retain your data

If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

What rights you have over your data

If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

Where we send your data

Visitor comments may be checked through an automated spam detection service.
Save settings
Cookies settings