Deployment error Linux VM on Azure Local

Jaco 85 Reputation points
2025-06-16T09:27:59.37+00:00

Hi! I'm currently trying to deploy an Ubuntu VM on my Azure Local instance but it fails during deployment. I've created an Azure Local VM-image by copying my VHD on my local Hyper-V VM, to the storagepath on my Azure Local cluster. Using the Azure CLI I managed to create a VM-image instance from it. This succeeded (see below)

User's image

When creating the VM, I get the following error:

User's image

{"code":"InternalError","message":"admission webhook "createupdatevalidationwebhook.infrastructure.azstackhci.microsoft.com" denied the request: admission webhook "createupdatevalidationwebhook.infrastructure.azhci.microsoft.com" denied the request: rpc error: code = NotFound desc = Type[GalleryImage], Location[MocLocation], Name[Ubuntu-2404]: Not Found"}

Would anyone have an idea what might be the issue? I have followed the following documentation for setting up the VM:

https://learn.microsoft.com/en-us/azure/azure-local/manage/virtual-machine-image-linux-sysprep?view=azloc-2504

Greetings Jaco

Azure Local
{count} votes

2 answers

Sort by: Most helpful
  1. Arko 4,150 Reputation points Microsoft External Staff Moderator
    2025-06-16T10:29:56.3233333+00:00

    Hello Jaco,

    The error message you're seeing indicates that Azure Local is attempting to reference a Gallery Image named Ubuntu-2404, but it doesn't exist or is not correctly registered in the local image gallery. To resolve this, you need to register the VHD-based image as a custom gallery image in your Azure Local environment. Ensure the VHD is generalized using cloud-init or waagent -deprovision+user. Follow think doc- https://learn.microsoft.com/en-us/azure/azure-local/manage/virtual-machine-image-linux-sysprep?view=azloc-2504

    Create an image definition. Follow this doc- https://learn.microsoft.com/en-us/azure/virtual-machines/image-version?tabs=cli%2Ccli2#create-an-image

    az azstackhci image-definition create \
      --resource-group <your-rg> \
      --gallery-name <your-gallery-name> \
      --image-definition-name Ubuntu-2404 \
      --publisher Canonical \
      --offer UbuntuServer \
      --sku 24_04-lts \
      --os-type Linux \
      --hyperv-generation V2
    

    Create a gallery image version using the VHD you uploaded, follow this document- https://learn.microsoft.com/en-us/cli/azure/stack-hci-vm/image?view=azure-cli-latest

    az azstackhci image-version create \
      --resource-group <your-rg> \
      --gallery-name <your-gallery-name> \
      --image-definition-name Ubuntu-2404 \
      --image-version 1.0.0 \
      --location MocLocation \
      --os-vhd-uri <path-to-your-vhd> \
      --storage-account <your-storage-account>
    

    Verify that the image version is available and then try to create the VM again, explicitly referencing this image version.

    0 comments No comments

  2. Jaco 85 Reputation points
    2025-06-19T08:34:55.1666667+00:00

    When I redeployed the VM-image using the following command, it worked. Am still not sure what the issue was since the attributes have the same value as before. It might have been the CLI extension version of the "azurestackhci" extension (currently version 0.2.9)

    az azurestackhci image create --extended-location name=$exlocname type=$exloctype -g $rg --name $imageName --location $region --image-path $imagePath --offer $offer --os-type $osType --sku $sku --publisher $publisher --storagepath-id $storagepath

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.