In this series I am going to show you how build a Windows 10 Image via Azure Pipelines and DevOps without 3rd party tooling, welcome to part 5!
We built the image, deployed a sessionhost in the previous parts. Next up is converting the Image Pipeline to YAML Pipelines. In addition, YAML pipelines hold all the features. Classic Pipelines do not.
Prerequisites
Part 1, 2 & 3 of this series needs to be completed. These are the links:
1. Windows 10 Image Series – Part 1 (Creating the Windows VM Pipeline)
2. Windows 10 Image Series – Part 2 (Artifacts & Application Installation)
3. Windows 10 Image Series – Part 3 (Shared Image Gallery)
Therefore, the prerequisites from part 1 are also required for this part. So:
Firstly, I am assuming that you have knowledge of Azure DevOps. These are the parts that already need be setup:
- Service Connection via Service Principal to ARM (more information)
- Azure Key Vault with connection to Azure DevOps (more information)
- GIT Repo in Azure DevOps (more information)
In addition, if you don’t have knowledge about Azure DevOps and still want to follow this series please let me know. I might write a blog about the preparing Azure DevOps.
Checkout/Skip to other parts:
0. Windows 10 Image Series – Part 0 (Preparing Azure/Azure DevOps)
1. Windows 10 Image Series – Part 1 (Creating the Windows VM Pipeline)
2. Windows 10 Image Series – Part 2 (Artifacts & Application Installation)
3. Windows 10 Image Series – Part 3 (Shared Image Gallery)
3.1 Windows 10 Image Series – Part 3.1 (Create test VM from Shared Image Gallery)
4. Windows 10 Image Series – Part 4 (SessionHost Deployment via Powershell and Classic Pipelines)
6. Windows 10 Image Series – Part 6 (Deploy Sessionhosts with Bicep and YAML)
Converting the WVD Image Build Pipeline to YAML
In this paragraph, we are actually converting the pipeline to YAML. The proces is quite simple. For instance, this is the part which creates the Windows 10 VM:
pool: name: 'NKO Agents' variables: - group: Windows10ImageVariables - group: AzureKeyVault stages: - stage: VirtualMachineCreation jobs: - job: VirtualMachineCreation steps: - task: AzureResourceManagerTemplateDeployment@3 displayName: 'ARM Template deployment: Windows 10 VM' inputs: azureResourceManagerConnection: 'WVDSpokeSub_Full' subscriptionId: 'ceb791cb-3889-4794-988c-367f7f6ff4f6' resourceGroupName: 'RG_WE_Win10ImageBuild_Temp' location: 'West Europe' csmFile: ARMTemplates/Windows10Template.json overrideParameters: '-location "$(Location)" -networkInterfaceName "W10BuildNIC" -subnetName "$(Subnet)" -virtualNetworkId "$(VNetResourceID)" -virtualMachineName "$(VMName)" -virtualMachineComputerName "W10Build" -osDiskType "Premium_LRS" -virtualMachineSize "Standard_B4ms" -adminUsername "W10Admin" -adminPassword $(LocalAdminPassword) -patchMode "Manual"'
Firstly, we need to create a YAML file in your repository in Azure DevOps. So, log on to Azure DevOps and go to repo’s:

After that, create a new file:

After that, name the file:

In addition, you can name the file anything you like.
Next up, copy the contents of my YAML file on my public Github Repo and paste it into your YAML file.
Please replace these values in the file:
<<Service Connection Name>>
<<Subscription ID>>
<<PAT Token>>
<<Artifact Build>>
<<DevOps Org Name>>
<<DevOps Project Name>>
After that, click on commit:

Secondly, we create the new YAML based pipeline. Go to Pipelines and click on new:

After that, click on “Azure Repos Git (YAML)”. In addition, you can also connect to the other Git repo options if you prefer that.

Choose the correct repository:

After that, pick “Existing Azure Pipelines YAML file” (the one we create earlier).

And select the proper file:

Save the pipeline:

Running the Pipeline
Go to your newly created YAML pipeline and click on run:

When you run the pipeline, these options are available:

When we look at stages, you can select which parts of the pipeline are run:

Please select the stages you want to use and click on run.
Eventually the pipeline has completed with the following result:

This was Windows 10 Image Series – Part 5, check out the other parts:
0. Windows 10 Image Series – Part 0 (Preparing Azure/Azure DevOps)
1. Windows 10 Image Series – Part 1 (Creating the Windows VM Pipeline)
2. Windows 10 Image Series – Part 2 (Artifacts & Application Installation)
3. Windows 10 Image Series – Part 3 (Shared Image Gallery)
3.1 Windows 10 Image Series – Part 3.1 (Create test VM from Shared Image Gallery)
4. Windows 10 Image Series – Part 4 (SessionHost Deployment via Powershell and Classic Pipelines)
6. Windows 10 Image Series – Part 6 (Deploy Sessionhosts with Bicep and YAML)
[…] 3 (Shared Image Gallery)4. Windows 10 Image Series – Part 4 (SessionHost Deployment from Image)5. Windows 10 Image Series – Part 5 (Convert the Image Build pipeline to […]
[…] Image Gallery) 4. Windows 10 Image Series – Part 4 (SessionHost Deployment from Image) 5. Windows 10 Image Series – Part 5 (Convert the Image Build pipeline to […]
[…] Installation) 4. Windows 10 Image Series – Part 4 (SessionHost Deployment from Image) 5. Windows 10 Image Series – Part 5 (Convert the Image Build pipeline to […]
[…] Windows 10 Image Series – Part 3 (Shared Image Gallery) 5. Windows 10 Image Series – Part 5 (Convert the Image Build pipeline to […]
[…] https://www.nielskok.tech/azure/windows-10-image-series-part-5/ […]
[…] Windows 10 Image Series – Part 5Niels Kok continues this series on how to build a Windows 10 Image via Azure Pipelines and Azure DevOps without third-party tooling. […]
[…] Windows 10 Image Series – Part 5 Niels Kok continues this series on how to build a Windows 10 Image via Azure Pipelines and Azure DevOps without third-party tooling. […]
[…] Windows 10 Image Series – Part 5Niels Kok continues this series on how to build a Windows 10 Image via Azure Pipelines and Azure DevOps without third-party tooling. […]
[…] 3 (Shared Image Gallery)4. Windows 10 Image Series – Part 4 (SessionHost Deployment from Image)5. Windows 10 Image Series – Part 5 (Convert the Image Build pipeline to YAML)6. Windows 10 Image Series – Part 6 (Deploy […]
Hi Nels
whne i add the yuml and i hit “stage to run” I get
Unable to load the pipeline’s stages.
nevermind working
btw you did the best devops packer articles that I so on the web,
oone more question
do you plan a post about how to add a extra step how to build a VM form the crated image not in AVW just a single VM a a next stage ?
Hi Roni,
Great to hear from you again 🙂 and I am glad that you got it working. Do you want me to create a post about creating single VM from the image via Code?
Thanks,
Niels
That would be great, after the image is done and save in the SIG a next stage would create a VM for that image so a user could test it.:)
BTW your blog is great and congrats on the MVP
Hi Roni,
Thanks, I am very glad that I have received the award :-)!
That’s a great idea. I will try do so in the coming weeks.
Kind Regards,
Niels
thx and keep up the great work!
Hi Roni,
I have added the part 3.1 for deploying a test VM:
https://www.nielskok.tech/azure-virtual-desktop/windows-10-image-series-part-3-1-deploy-test-vm/
Kind Regards,
Niels
[…] Windows 10 Image Series – Part 4 (SessionHost Deployment via Powershell and Classic Pipelines)5. Windows 10 Image Series – Part 5 (Converted the Image build pipeline to […]
[…] (Shared Image Gallery)4. Windows 10 Image Series – Part 4 (SessionHost Deployment from Image) 5. Windows 10 Image Series – Part 5 (Convert the Image Build pipeline to YAML)6. Windows 10 Image Series – Part 6 (Deploy […]