Packer YAML Windows 365 Image

This blog is about using Packer and YAML to create a Windows 365 Image. This is an add-on to the first blog in the series on Packer.

Prerequisites

Make sure you have completed the first blog in this series:

Packer YAML Azure DevOps Pipeline Pt. 1 – Create the Packer YAML Pipeline

After that, you are ready to start this blog!

Create the Windows 365 Image pipeline

The first part is pretty simple. We need to duplicate the files from part 1 and rename them for a bit to create a new pipeline.

These are the files that need to be edited:

Packer YAML Windows 365 Image - Copy source Files
Please make sure that you rename the files to get this result:
Packer YAML Windows 365 Image - renamed source files
After that, we need to edit the files.

Firstly, the Windows365Variables.pkr.hcl file. We need to edit the “managed_image_resource_group_name” & the “SKU” (also the offer if you want to change it to Windows 11)
Packer YAML Windows 365 Image - editted variable file
Next, we need to edit the Windows365Image.pkr.hcl

In this file we edit the “managed_image_name”:

And lastly, we edit the Windows365ImagePacker.yml:

In stage 1 “CreateResourceGroup” edit the resourcegroupname:

In stage 2 “RunPacker” edit these files to represent the new files we just copied from our AVD pipeline:

Packer YAML Windows 365 Image - edited packer variables

After that, go to pipelines:

Click New pipeline:

Select Azure Repos Git:
Select the appropriate repository:
And choose an Existing Azure Pipelines YAML file:
After that, select the Windows365ImagePacker.yml:

After that, please run the pipeline to make sure everything works as expected. If everything works, you should have a managed image in the resource group “RG_WE_W365_Image”:

Add the Image to Windows 365

NOTE: This part is still manual, I plan to automate this later. I have run into some issues.

Firstly, log on to Microsoft Endpoint Manager

And after that, go to the Windows 365 blade:

Click on add and fill in the parameters:

The upload takes about 15 minutes but after that, you have your custom image in Windows 365:

1 thought on “Packer YAML Windows 365 Image”

Leave a Comment