The DevOps Quest

🗺️

How to find Virtual Machine SKUs

📅

⏱️ 3 min read (497 words)

I found it a little challenging understanding how to obtain the SKU details required to deploy a Virtual Machine using Bicep

The Microsoft.Compute/virtualMachines resource requires a few properties related to the image/sku of the machine.

imageReference: {
    publisher: '?'
    offer: '?'
    sku: ?
    version: 'latest'
}

To obtain these properties some Powershell is required. The examples given in the offical Microsoft documentation weren’t particularly helpful in my opinion.

In this example I’m going to look for a Microsoft Windows 10 image.

First of all we need to obtain a list of publishers. In this case we want to look for the publisher Microsoft.

Get-AzVMImagePublisher -location uksouth | where {$_.publishername -like "*microsoft*"}

PublisherName                                                 Location
-------------                                                 --------
Microsoft.Windows.RemoteDesktop                               uksouth
Microsoft.Azure.WorkloadInsights.Windows.ReleasePipeTest.INT  uksouth
SentinelOne.WindowsExtension                                  uksouth
Microsoft.Azure.Security.TestWindowsAttestation               uksouth
Microsoft.Azure.Security.WindowsCodeIntegrity                 uksouth
Dans.Windows.App                                              uksouth
Chef.Bootstrap.WindowsAzure                                   uksouth
Dans3.Windows.App                                             uksouth
Microsoft.VisualStudio.WindowsAzure.DevTest                   uksouth
Microsoft.Azure.WindowsFabric.Test                            uksouth
SentinelOne.WindowsExtension.Test                             uksouth
Microsoft.WindowsAdminCenter                                  uksouth
Microsoft.WindowsAzure.Compute.test                           uksouth
Microsoft.WindowsAdminCenter.Test                             uksouth
Microsoft.Windows.Azure.Extensions                            uksouth
Microsoft.VisualStudio.WindowsAzure.RemoteDebug               uksouth

This returns a lot of random publishers that don’t really look like what we’re after. Let’s try search for Windows instead.

Get-AzVMImagePublisher -location uksouth | where {$_.publishername -like "*windows*"}

PublisherName                                                 Location
-------------                                                 --------
Microsoft.Windows.RemoteDesktop                               uksouth
Microsoft.Azure.WorkloadInsights.Windows.ReleasePipeTest.INT  uksouth
SentinelOne.WindowsExtension                                  uksouth
Microsoft.Azure.Security.TestWindowsAttestation               uksouth
Microsoft.Azure.Security.WindowsCodeIntegrity                 uksouth
Dans.Windows.App                                              uksouth
Chef.Bootstrap.WindowsAzure                                   uksouth
Dans3.Windows.App                                             uksouth
Microsoft.VisualStudio.WindowsAzure.DevTest                   uksouth
Microsoft.Azure.WindowsFabric.Test                            uksouth
SentinelOne.WindowsExtension.Test                             uksouth
Microsoft.WindowsAdminCenter                                  uksouth
Microsoft.WindowsAzure.Compute.test                           uksouth
Microsoft.WindowsAdminCenter.Test                             uksouth
Microsoft.Windows.Azure.Extensions                            uksouth
Microsoft.VisualStudio.WindowsAzure.RemoteDebug               uksouth
MicrosoftWindowsDesktop                                       uksouth
Microsoft.Azure.WorkloadInsights.Windows.ReleasePipeTest.TEST uksouth
Qualys.WindowsAgent.GrayLabel                                 uksouth
MicrosoftWindowsServerHPCPack                                 uksouth
Microsoft.VisualStudio.WindowsAzure.Test.RemoteDebug          uksouth
MicrosoftWindowsServer                                        uksouth
Microsoft.VisualStudio.WindowsAzure.DevTest.Test              uksouth

Ah! That’s more like it. We can see a publisher called “MicrosoftWindowsDesktop”

MicrosoftWindowsDesktop and MicrosoftWindowsServer are commonly used.

Okay so we have the Publisher now. Next we need to find the offer. To do this we need to use the Publisher name.

Get-AzVMImageOffer -Location uksouth -PublisherName "MicrosoftWindowsDesktop"

Offer                                        PublisherName           Location
-----                                        -------------           --------
test_sj_win_client                           MicrosoftWindowsDesktop uksouth  
Windows-10                                   MicrosoftWindowsDesktop uksouth  
windows-10-1607-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-10-1803-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-10-1809-vhd-client-office-prod-stage MicrosoftWindowsDesktop uksouth  
windows-10-1809-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-10-1903-vhd-client-office-prod-stage MicrosoftWindowsDesktop uksouth  
windows-10-1903-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-10-1909-vhd-client-office-prod-stage MicrosoftWindowsDesktop uksouth  
windows-10-1909-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-10-2004-vhd-client-office-prod-stage MicrosoftWindowsDesktop uksouth  
windows-10-2004-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-10-20h2-vhd-client-office-prod-stage MicrosoftWindowsDesktop uksouth  
windows-10-20h2-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-10-ppe                               MicrosoftWindowsDesktop uksouth  
windows-11                                   MicrosoftWindowsDesktop uksouth  
windows-7                                    MicrosoftWindowsDesktop uksouth  
windows-7-0-sp1-vhd-client-prod-stage        MicrosoftWindowsDesktop uksouth  
windows-ent-cpc                              MicrosoftWindowsDesktop uksouth  
windows-evd                                  MicrosoftWindowsDesktop uksouth  

Looking at the list we want just Windows 10. So Windows-10 looks like the correct one to try.

Next we need to obtain the SKU.

Get-AzVMImageSku -PublisherName "MicrosoftWindowsDesktop" -offer "Windows-10" -Location uksouth

Skus                        Offer      PublisherName
----                        -----      -------------
21h1-pro-g2                 Windows-10 MicrosoftWindowsDesktop
21h1-pro-zh-cn              Windows-10 MicrosoftWindowsDesktop
21h1-pro-zh-cn-g2           Windows-10 MicrosoftWindowsDesktop
21h1-pron                   Windows-10 MicrosoftWindowsDesktop
21h1-pron-g2                Windows-10 MicrosoftWindowsDesktop
win10-21h2-pro-zh-cn-g2     Windows-10 MicrosoftWindowsDesktop
win10-21h2-pron             Windows-10 MicrosoftWindowsDesktop
win10-21h2-pron-g2          Windows-10 MicrosoftWindowsDesktop
win10-22h2-avd              Windows-10 MicrosoftWindowsDesktop
win10-22h2-avd-g2           Windows-10 MicrosoftWindowsDesktop
win10-22h2-ent              Windows-10 MicrosoftWindowsDesktop
win10-22h2-ent-g2           Windows-10 MicrosoftWindowsDesktop
win10-22h2-entn             Windows-10 MicrosoftWindowsDesktop
win10-22h2-entn-g2          Windows-10 MicrosoftWindowsDesktop
win10-22h2-pro              Windows-10 MicrosoftWindowsDesktop
win10-22h2-pro-g2           Windows-10 MicrosoftWindowsDesktop
win10-22h2-pro-zh-cn        Windows-10 MicrosoftWindowsDesktop
win10-22h2-pro-zh-cn-g2     Windows-10 MicrosoftWindowsDesktop
win10-22h2-pron             Windows-10 MicrosoftWindowsDesktop
win10-22h2-pron-g2          Windows-10 MicrosoftWindowsDesktop

I have removed quite a few from the output here as the list is quite long. But let’s select the win10-22h2-pro

So now we have all the details we need.

imageReference: {
    publisher: 'MicrosoftWindowsDesktop'
    offer: 'Windows-10'
    sku: 'win10-22h2-pro'
    version: 'latest'
}

Hopefully this guide helps you search for Virtual Machine SKUs.

Health ❤️ ❤️ ❤️ ❤️ ❤️

See you soon!