8

We are currently using Ubuntu Server 18.04 LTS for our self-hosted Azure VMs and looking into upgrading them to Ubuntu Server 20.04 LTS. We used the URN Canonical:UbuntuServer:18.04-LTS:latest to create our existing self-hosted Azure VMs.

This webpage link (https://az-vm-image.info/?cmd=--all+--publisher+Canonical) lists the URNs for the various Azure VM images that az vm image list --output table command would list from the Azure CLI.

If you collapse groups for that webpage, I would expect a Canonical - UbuntuServer - 20.04-LTS or Canonical:UbuntuServer:20.04-LTS:<version>to be at the end of that list but it isn't. I know the Azure VM image exist though because the marketplace has it: https://azuremarketplace.microsoft.com/en-us/marketplace/apps/canonical.0001-com-ubuntu-server-focal?tab=Overview

I'm new to this so I'm not sure how to get the URN out of that marketplace link or which is the correct URN at the az-vm-image link above to get UbuntuServer 20.04 LTS for our self-hosted Azure VMs.

For reference, I am using the Azure CLI command az vm create .. --image Canonical:UbuntuServer:18.04-LTS:latest .. to create our VMs. I tried Canonical:UbuntuServer:20.04-LTS:latest and the VM image doesn't exist.

Minreaux
  • 171

2 Answers2

9

Found a GitHub issue that tells which is the correct URN: https://github.com/Azure/azure-cli/issues/13320#issuecomment-649867249

Looks like the offer and SKU format were changed for 20.04 which is why it could not be found. The correct URN for Ubuntu Server 20.04-LTS is Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest.

Minreaux
  • 171
0

In packer use :

variable "azure_subscription_id" {
  type = string
  default = ""
}
variable "region" {
  default = "Australia East"
}
variable "resource_group_name" {
  default = "my-images"
}

locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } source "azure-arm" "azure-ubuntu" {

Ubuntu Base Image

image_publisher = "Canonical" image_offer = "0001-com-ubuntu-server-focal-daily" image_sku = "20_04-daily-lts-gen2"

Azure Details

vm_size = "Standard_B1ls" subscription_id = var.azure_subscription_id location = var.region os_type = "Linux"

Managed Image Details

managed_image_name = "my-image-name-fixme-${local.timestamp}-{{uuid}}" managed_image_resource_group_name = var.resource_group_name }

build { sources = ["source.azure-arm.azure-ubuntu"]

TODO: Add all your apt-get and shell provisioners and co ...

}

Run with : packer build -var 'azure_subscription_id=FIXME' -var "region=australiasoutheast" -var "resource_group_name=FIXME"

Thomas
  • 133
  • 1
  • 5