Download Azure Linux Marketplace Image
This is a guide on how to download a marketplace image from Azure so that it can be customized using Image Customizer.
Steps
-
Login to Azure with the CLI.
az login
-
Verify your default subscription.
az account show --output table
-
If necessary, change your default subscription to one you have permissions to create resources in.
SUBSCRIPTION_NAME="<subscription-name>" az account set --subscription "$SUBSCRIPTION_NAME"
-
List the Azure Linux marketplace images.
For Azure Linux 2.0:
az vm image list --publisher MicrosoftCBLMariner --offer cbl-mariner --sku cbl-mariner-2-gen2 --all --output table
For Azure Linux 3.0:
az vm image list --publisher MicrosoftCBLMariner --offer azure-linux-3 --sku azure-linux-3-gen2 --all --output table
-
Pick an image and copy its URN.
For example:
IMAGE_URN="MicrosoftCBLMariner:azure-linux-3:azure-linux-3-gen2:3.20250102.02"
-
Create a managed disk from the marketplace image.
DISK_NAME="<disk-name>" DISK_RG="<disk-resource-group-name>" DISK_LOC="<azure-location>" az group create --location "$DISK_LOC" --name "$DISK_RG" az disk create -g "$DISK_RG" -n "$DISK_NAME" --image-reference "$IMAGE_URN"
-
Generate SAS URL:
SAS_JSON="$(az disk grant-access --duration-in-seconds 86400 --access-level Read --name "$DISK_NAME" --resource-group "$DISK_RG")" SAS_URL="$(jq -r '.accessSas // .accessSAS' <<< "$SAS_JSON")"
-
Download VHD:
az storage blob download -f ./image.vhd --blob-url "$SAS_URL"
-
Delete temporary resources:
az group delete --name "$DISK_RG" --no-wait