2

I'm creating a packer image using these two links: https://www.packer.io/docs/builders/azure.html https://learn.microsoft.com/en-us/azure/virtual-machines/linux/build-image-with-packer

I want to use a 'private image' rather than a marketplace image to build from:

"managed_image_resource_group_name": "myResourceGroup",
"managed_image_name": "myPackerImage",

"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "16.04-LTS",

How do I reference my own images in "image_publisher", "image_offer", "image_sku" etc?

"os_type": "Linux",
"image_publisher": "myPrivateRepo",
"image_offer": "UbuntuWeb",
"image_sku": "16-1.0",

Thanks in advance

James Liu
  • 196
  • 1
  • 2
  • 10

2 Answers2

1

I have never tried this myself, but it seems to work like this.

Instead of

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

write

"image_url": "https://my-storage-account.blob.core.windows.net/path/to/your/custom/image.vhd",
kim
  • 3,385
  • 2
  • 15
  • 21
  • Is there way to find this blob? I've tried to find this vhd initially created by: * Portal * az image list – James Liu Mar 15 '18 at 08:05
  • Look in the Azure portal if you have any storage accounts. Inside them open "blobs", there you should find your .vhd files. – kim Mar 15 '18 at 08:29
  • In fact, it only works for unmanaged image(VHD), `az image list` return managed image. – Shui shengbao Mar 16 '18 at 08:24
  • ```az image list``` will show all image but image_url for ```.vhd``` how can i use existing manage image – sanjayparmar Dec 13 '19 at 19:45
  • in case of manage image output would be OSType: Windows ManagedImageResourceGroupName: myResourceGroup ManagedImageName: packerimagewin2019up ManagedImageId: /subscriptions/XXXXXXXXX/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/packerimagewin2019up ManagedImageLocation: eastus – sanjayparmar Dec 13 '19 at 19:47
0

I used the custom_managed_image_name and custom_managed_image_resource_group_name properties to get this to work.

muhmud
  • 4,474
  • 2
  • 15
  • 22