Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Packer ARM Succeeded - Now What? #201
So the packer script succeeded after assigning the application I created with the Owner role to the Subcription object. I see the blob in my storage account but now I'm stuck at figuring out how we actually hydrate that image into a running VM? There doesn't seem to be any functionality in the Azure portal to do that. Could you please advise on the recommended steps?
The latest Azure portal does not currently provide too much if you just want to deploy and go..
At the end of a packer build you will have a template (.json), and a .vhd.
Assuming these are the names of our resources.
Create a NIC.
azure network nic create MyResourceGroup MyNic westus --subnet-vnet-name MyVirtualNetwork --subnet-name MySubnet
The above command will out an Id for the NIC just created. Copy it, and use it in the command below.
Deploy a VM based on our image.
azure group deployment create -g MyResourceGroup -n MyDeployment --template-uri https://...
The above command will automatically prompt you for all of the values in the template that need to be set, such as vmName, adminUserName, adminPassword, and networkInterfaceId.
referenced this issue
Jul 14, 2016
Here's the CLI guide for folks who are still finding their way around Packer and AzureRM:
Create the NIC
Assuming you're using the same ARM_RESOURCE_GROUP and LOCATION from
This last command will spit out a lot JSON, you'll want the line that looks like this:
Create a params files
Run create with template-uri and parameters
Then I could run
Since there's no public IP associated with the instance here, it cant actually be reached, but it should exist.
Wondering if packer can be used to generate a custom rhel/centos image for azure. (Azure uses a set of steps for Hyper-V - https://docs.microsoft.com/en-us/azure/virtual-machines/linux/redhat-create-upload-vhd), The image I am referring to is not from any publishers from market place or aws, instead the image contains the OS plus a set of customizations that include separate filesystems / /home, etc to name a few, so when I build my VM through packer, the VM already contains all these I am looking for.
Or the right way to go with using packer to provision Azure VMs is to first have this custom .vhd file ready as depicted in the link here https://docs.microsoft.com/en-us/azure/virtual-machines/linux/redhat-create-upload-vhd and use that VHD to build VMs on Azure? Now with this same VHD, can packer be used to provision VMs on other platforms like aws, vmware, etc?
Yes, you can start from a custom image. Please review https://www.packer.io/docs/builders/azure.html. Using the same image on Azure, AWS, and VMware will be trickier. My default opinion, having never done this, is to instead create a common recipe for building the image, and then use the builder from each cloud provider with your common recipe. I am sure you could make one image work, but you would have to deal with all of the various platform issues (kernel drivers, services, etc), which may not be worth it.
There are examples in the official Packer repository to help get you started.