简体   繁体   中英

Creating Windows Image from VM using Packer

I have to create an Image from an existing VM using Packer. This is the link I'm following to do so.

Now I have few doubts in this before proceeding further.

  1. Can I run all these commands remotely.
  2. If yes, where should I install Packer , is it on client Machine or remote machine?
  3. If it has to be installed on remote machine, from which the image is being created, is there any workaround for that. I will not have access to install anything on the remote machine.
  4. No where the VM details are not mentioned. Does that mean, it will automatically take the VM details when we run the commands on the VM?
  5. Where can I see the output of the whole process? Will it be available in azure portal?

Any inputs on the above questions are appreciated.Thanks!

First of all, there is something you have misunderstood about Packer.

The Azure builder can create either a VHD, or a managed image. If you are creating a VHD, you must start with a VHD. Likewise, if you want to create a managed image you must start with a managed image.

It means you must create the image from the image or VHD, not VM.

The answer to your question.

  1. Yes, you can run the command remotely, just like Azure CLI.
  2. You can install Packer on your on-premise machine.
  3. From the description of Packer, it just needs the image information.
  4. You can see the output where you run the Packer command.

Update

When you want to create the image from VHD file, you can make an instead:

"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "16.04.0-LTS",

Into

"image_url": "https://my-storage-account.blob.core.windows.net/path/to/your/custom/image.vhd",

If your vm is managed by Azure, you can pay attention to the option of custom_managed_image and images in Azure . Hope this will be helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM