Picking the marketplace Image

The first thing to do is to find the version of Windows 10 or Windows Server you want to base your image off.

To see all the marketplace image publishers use the following:
$locName="West US"
Get-AzVMImagePublisher -Location $locName | Select PublisherName
We are only interested in the MicrosoftWindowsDesktop or Server for this demo.
Then we want to get the offers from that publisher with the following:
Get-AzVMImageOffer -Location "West US" -PublisherName "MicrosoftWindowsDesktop" | Select Offer
Once we have the offer in this case Windows-10 we want to get the sku we will be using
$offerName="Windows-10"
Get-AzVMImageSku -Location $locName -PublisherName $pubName -Offer $offerName | Select Skus
In our case we want to build the latest OS so we picked 20h2-ent .

Source: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/cli-ps-findimage

The base image is updated monthly and comes out after patch Tuesdays so you can pick a previous release and as long as it is supported you will get the latest build with latest patches.

Next we start building our packer template.