So you have been running your favorite VM creation script, something like: az vm create -g GROUPNAME -n VMNAME -l EASTUS2 –image Canonical:UbuntuServer:18_04-lts-gen2:latest and you get the error: Can’t resolve the version of ‘Canonical:UbuntuServer:18.04-LTS’
Can't resolve the version of 'Canonical:UbuntuServer:18.04-LTS'This happens when the version you were using in your script has been depreciated and is no longer available in Azure to create images with. If you have an existing VM running on that Image, you could generalize it and continue to use it from a Azure Compute Gallery, or you can utilize an altnerate Marketplace Image. To check and see what current images are available, you can do so via:
az vm image list --location $locationName --publisher $publisherName --offer $offerName --sku $imagesku --all | ConvertFrom-JsonThis is easy, when you know the exact name of the publisher, offer and SKU name – but is a little bit more challenging if you don’t. To help you out, we have provided the following PowerShell script that works great in Windows due to querying the user for input on each request, requesting the location (region), publisher, offer, and SKU which can all be chosen in a menu system.
Give it a try in PowerShell ISE:
######## List Image Versions Per Region ########
############ Remeber To Az login ###############
## Choose [OK] after selection on Lower Right ##
### Eg. MicrosoftWindowsServer:WindowsServer ###
$planInfo = $null
$locationName = (az account list-locations | ConvertFrom-Json).displayName | Out-GridView -PassThru -Title "Choose a location"
$publisherName = (az vm image list-publishers --location $locationName | ConvertFrom-Json).name| Out-GridView -PassThru -Title "Choose a publisher"
$offerName = (az vm image list-offers --location $locationName --publisher $publisherName | ConvertFrom-Json).name | Out-GridView -PassThru -Title "Choose an offer"
$imageSku = (az vm image list-skus --location $locationName --publisher $publisherName --offer $offerName | ConvertFrom-Json).name | Out-GridView -PassThru -Title "Choose an offer"
$imageListings = az vm image list --location $locationName --publisher $publisherName --offer $offerName --sku $imagesku --all | ConvertFrom-Json
## Image Listings ##
Write-Host "`nImage Listing for:" $locationName ">" $publisherName ">" $offerName ">" $imageSku "`n"
foreach($image in $imageListings)
{
Write-Host $image.urn
}
## Display Last Plan Info only ##
$planInfo = az vm image show --location $locationName --urn $image.urn --query plan
$terms = az vm image terms show --urn $image.urn | ConvertFrom-Json
Write-Host "`nPlanInfo:" $planInfo -Separator `n
Write-Host "`nTerms Accepted:`t" $terms.accepted "`nLicense:`t" $terms.licenseTextLink "`nMarketPlace:`t" $terms.marketplaceTermsLink
## To Accept Terms: az vm image terms accept --urn <urn-image-name>
Note that Out-GridView -PassThru here allows you to filter the output like a search, and you can also sort according columns. Also note, that the OK selection button is on the far lower right hand corner of each popup created by Out-GridView (ever so slightly out of view depending on your monitor width):


We understand that our previous Offer was “UbuntuServer” and we see that selection still, but what happens if we select it?
- After choosing: UbuntuServer, 18.10 our output is an error output as there is no available image
- There is no PlanInfo, no Terms and no License which can be displayed either
- In effect our choice here was:
az vm image list --location EASTUS --publisher Canonical --offer UbuntuServer --sku 18.10 --allAnd the output for that command is effectively $null or no output, as there are no images of that Publisher, Offer, SKU.
So where did Ubuntu Server Go?
Let’s check again, but this time choose:
- Location: EAST US, OK
- Publisher: Canonical, OK
- Offer (Name): ubuntu-24_04-lts, OK
- Offer (SKU): server, OK
Now we can see we get an output for all relative images for the Location, Publisher and Offer Chosen:

Hence, if we now want to solve our original error where our older image was not found, we could now fix that understanding the most current URN name (Uniform Resource Name). That new creation script with the new URN name would be:
az vm create -g GROUPNAME -n VMNAME -l EASTUS2 --image Canonical:ubuntu-24_04-lts:server:latestNOTE: For this particular image, there are not Terms to Accept, but such terms must be accepted to create various other images – for example: if we look at an Image like: netapp:netapp-ontap-cloud:ontap_cloud_byol – we should notice that:
- For such a third-party image there are terms to accept
- We cannot deploy such an image without accepting those terms
- Accepting Terms is mentioned in the last code comment and occurs via the command: az vm image terms accept –urn <urn-image-name>
- The PlanInfo is also output here, in the event that you need that PlanInfo when storing such an image or recreating a VM from such an image for which you do not posses the PlanInfo name, product and publisher information.

Here is an example of a deployment failure due to not accepting the Terms:
{“error”:{“code”:”MarketplacePurchaseEligibilityFailed”,”message”:”Marketplace purchase eligibilty check returned errors. See inner errors for details. “,”details”:[{“code”:”BadRequest”,”message”:”Offer with PublisherId: ‘qualysguard’, OfferId: ‘qualys-virtual-scanner’ cannot be purchased due to validation errors. For more information see details. Correlation Id: ’20ae244f-a7f7-4d33-a3bf-53a39ed9ebb1′ You have not accepted the legal terms on this subscription…
Accept the Terms:
az vm image terms accept --urn qualysguard:qualys-virtual-scanner:qvsa:2.7.2906Success after accepting the terms:

