Score:1

How can I create VM using my custom Image on Azure?

kw flag

I have a problem with starting a VM on Azure using my custom image.

How I prepared my custom image:

  1. I had a VM running, based on an image from the Azure Marketplace.
  2. I stopped that VM and exported the OS disk (downloaded the VHD file).
  3. I uploaded that VHD file as a BLOB to my storage account on Azure.
  4. I created a new image (Images -> Create), selecting the previously uploaded VHD file as "Storage Blob."

Starting VM by UI

  1. When I try to create a new VM using my custom image through the Azure Web UI, the deployment fails with the following error message:
    {
      "code": "ResourceDeploymentFailure",
      "message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'."
    }

Starting VM by Azure Golang SDK

  1. When I try to launch a VM from the code level and I fill the armcompute.VirtualMachineProperties with image ID:
            StorageProfile: &armcompute.StorageProfile{
                ImageReference: &armcompute.ImageReference{
                    ID: to.Ptr("/subscriptions/MY_SUBSCRIPTION/resourceGroups/MY_RESOURCE_GROUP/providers/Microsoft.Compute/images/MY_IMAGE_NAME"), 
                },

to execute VirtualMachinesClient.BeginCreateOrUpdate method, I receive the following error:

Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request

Does this mean that I always need to remember on which Marketplace image my custom image is based? I was planning to create several different custom images based on VMs running on various systems, and I thought that later, to use such images, only the Image ID would be sufficient.

Of course, when I'm filling Plan field with some random values, there is an error:

The offer with Offer ID 'YOUR_OFFER' was not found.

Score:1
ng flag

You can't just create an image from a Marketplace VM and provide it with random offer details. Any image you create from a Marketplace VM, will have the same offer requirements the original VM had. Otherwise this would be a very easy way to get away with not paying for any licencing the original marketplace VM had. You can find details of how to provide the offer ID here.

Secondly, you can't just export an existing managed disk to a blob and then use that as an image to create new VMs. You need to go through a process of creating an image by following the steps here. Please note that this is a legacy approach and the better option is to use the Azure Compute Gallery

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.