There is another way to Find and use Azure Marketplace VM images with Azure PowerShell. You can do the same task to fetch Azure VM information using is az cli. There are two common images UbuntuServer and MicrosoftWindowsServer. Here I will work with Ubuntu images to get information from az cli commands.
The first command is to list all the available publishers in Azure marketplace. Shown information on the console is in JSON format and it is a long list of publishers, so to filter and find only required information I am using az cli inbuilt JMESpath language to get what I want. To know more about jmespath check https://jmespath.org/.
└ $ az vm image list-publishers -l westus --query "[?starts_with(name, 'Canonical')]" [ { "extendedLocation": null, "id": "/Subscriptions/9e22xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/Providers/Microsoft.Compute/Locations/westus/Publishers/Canonical", "location": "westus", "name": "Canonical", "tags": null } ]
Once you have publisher names, use one of the publisher names to fetch their offerings.
└ $ az vm image list-offers --location westus --publisher Canonical --query "[?name=='UbuntuServer']" [ { "extendedLocation": null, "id": "/Subscriptions/9e22xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/Providers/Microsoft.Compute/Locations/westus/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer", "location": "westus", "name": "UbuntuServer", "tags": null } ]
Next using the information collected publisher and offers, you can get the skus list in table output.
└ $ az vm image list-skus -l westus -f UbuntuServer -p Canonical --query "[?starts_with(name, '18')]" --output table Name Location --------------------- ---------- 18.04-DAILY-LTS westus 18.04-LTS westus 18.10 westus 18.10-DAILY westus 18_04-daily-lts-arm64 westus 18_04-daily-lts-gen2 westus 18_04-lts-arm64 westus 18_04-lts-gen2 westus
In the last if you need detailed information about of latest image use below command.
└ $ az vm image show --location westus --urn Canonical:UbuntuServer:18.04-LTS:latest
{
"architecture": "x64",
"automaticOsUpgradeProperties": {
"automaticOsUpgradeSupported": true
},
"dataDiskImages": [],
"disallowed": {
"vmDiskType": "None"
},
"extendedLocation": null,
"features": [
{
"name": "IsAcceleratedNetworkSupported",
"value": "True"
},
{
"name": "DiskControllerTypes",
"value": "SCSI, NVMe"
},
{
"name": "IsHibernateSupported",
"value": "True"
}
],
"hyperVGeneration": "V1",
"id": "/Subscriptions/9e22xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.Compute/Locations/westus/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.202210180",
"location": "westus",
"name": "18.04.202210180",
"osDiskImage": {
"operatingSystem": "Linux",
"sizeInBytes": 32213303808,
"sizeInGb": 31
},
"plan": null,
"tags": null
}
Useful Articles
Create a Azure Virtual Network with Subnet using PowerShell
Azure add create a Subnet to existing Virtual Network using PowerShell
Remove Azure Virtual Network Subnet using PowerShell
Create key vault and secrets with access policies in Microsoft Azure
Working With Azure Key Vault Using Azure PowerShell and AzureCLI
Use Key Vault secret identifier url to get the secret value using Powershell
Use a Azure VM system assigned managed identity to access Azure Key Vault
Create Azure Key Vault Certificates on Azure Portal and Powershell
Export certificates from Azure Key Vault using PowerShell