Edit

Share via


Create Azure Local VM image using Azure Marketplace images

Applies to: Hyperconverged deployments of Azure Local 2311.2 and later

This article explains how to create Windows virtual machine (VM) images for Azure Local by using source images from Azure Marketplace, either through the Azure portal or Azure CLI.

To create Linux VM images from Azure Marketplace, choose:

Prerequisites

Before you begin, make sure that you complete the following prerequisites.

  • Review and complete the prerequisites.

  • Assign the Azure Connected Machine Resource Manager role to the Microsoft.AzureStackHCI resource provider app for the resource group where you want to download the image. For more information, see Assign Azure roles.

  • Register your subscription with the Microsoft.EdgeMarketplace resource provider. For more information, see Register resource provider.

Add VM image from Azure Marketplace

Create a VM image starting from an Azure Marketplace image. Use this image to deploy VMs on your Azure Local instance.

Follow these steps to create a VM image using the Azure CLI.

Sign in and set subscription

  1. Connect to a machine on your Azure Local.

  2. Sign in. Type:

    az login --use-device-code
    
  3. Set your subscription.

    az account set --subscription <Subscription ID>
    

Set some parameters

  1. Set parameters for your subscription, resource group, location, and OS type for the image. Replace the parameters in < > with the appropriate values.

    $subscription = "<Subscription ID>"
    $resource_group = "<Resource group>"
    $mktplaceImage = "<Marketplace image name>"
    $customLocationName = "<Custom location name>"
    $customLocationID = (az customlocation show --resource-group $resource_group --name "<custom_location_name_for_Azure_Local>" --query id -o tsv)
    $location = "<Location for your Azure Local>"
    $osType = "<OS of source image>"
    $version = "<OS version of Marketplace image>"
    

    The parameters are described in the following table:

    Parameter Description
    subscription Subscription associated with your Azure Local.
    resource-group Resource group for your Azure Local that you associate with the Marketplace image.
    name Name of the Marketplace image for Azure Local.
    customLocation Resource ID of custom location for your Azure Local.
    location Location for your Azure Local. For example, eastus.
    os-type Operating system associated with the source image. For example, Windows or Linux.
    version (Optional) Specify the OS version for Marketplace image. If left empty, it defaults to the latest version.

    Here's a sample output:

    PS C:\Users\azcli> $subscription = "<Subscription ID>"
    PS C:\Users\azcli> $resource_group = "mylocal-rg"
    PS C:\Users\azcli> $mktplaceImage= "mylocal-marketplaceimage"
    PS C:\Users\azcli> $customLocationName = "mylocal-cl"
    PS C:\Users\azcli> $customerLocationID /subscriptions$subscription/resourcegroups/$resource_group/providers/microsoft.extendedlocation/customlocations/$customLocationName
    PS C:\Users\azcli> $location = "eastus"
    PS C:\Users\azcli> $ostype = "Windows"
    PS C:\Users\azcli> $version = "26100.4652.250808"
    

Note

If you encounter compatibility issues, check the VM image version. Azure CLI always defaults to the latest version.

Create VM image from Marketplace image

  1. Set additional parameters that specify the intended VM image you want to create. You need to include the offer, publisher, SKU, and version for the marketplace image. Replace the parameters in < > with the appropriate values:

    $publisher = "<Publisher name>"
    $offer = "<OS offer>"
    $sku = "<Image SKU>"
    

    Use the following table to find the available marketplace images and their attribute values:

    Name Publisher Offer SKU
    Windows 11 Enterprise multi-session + Microsoft 365 microsoftwindowsdesktop office-365 win11-23h2-avd-m365
    win11-24h2-avd-m365
    Windows 10 Enterprise multi-session + Microsoft 365 microsoftwindowsdesktop office-365 win10-21h2-avd-m365
    Windows 11 Pro microsoftwindowsdesktop windows-11 win11-23h2-pro
    Windows 11 Enterprise microsoftwindowsdesktop windows-11 win11-22h2-ent
    win11-23h2-ent
    win11-24h2-ent
    Windows 11 Enterprise multi-session microsoftwindowsdesktop windows-11 win11-22h2-avd
    win11-23h2-avd
    win11-24h2-avd
    Windows 10 Pro microsoftwindowsdesktop windows-10 win10-22h2-pro-g2
    Windows 10 Enterprise microsoftwindowsdesktop windows-10 win10-22h2-ent-g2
    Windows 10 Enterprise multi-session microsoftwindowsdesktop windows-10 win10-22h2-avd
    Windows Server 2025 Datacenter: Azure Edition microsoftwindowsserver windowsserver 2025-datacenter-azure-edition-smalldisk
    2025-datacenter-azure-edition-core
    2025-datacenter-azure-edition
    Windows Server 2022 Datacenter: Azure Edition microsoftwindowsserver windowsserver 2022-datacenter-azure-edition-hotpatch
    2022-datacenter-azure-edition-core
    2022-datacenter-azure-edition
    Windows Server 2019 microsoftwindowsserver windowsserver 2019-datacenter-gensecond
    2019-datacenter-core-g2
    SQL Server 2022 Enterprise on Windows Server 2022 microsoftsqlserver sql2022-ws2022 enterprise-gen2
    standard-gen2

    If you want to create a Windows Server 2019 Datacenter image, use the following parameters:

    $publisher = "microsoftwindowsserver" 
    $offer = "windowsserver" 
    $sku = "2019-datacenter-gensecond"
    
  2. Create the VM image starting with a specified marketplace image:

    az stack-hci-vm image create --resource-group $resource_group --custom-location $customLocationID --name $mktplaceImage --os-type $ostype --offer $offer --publisher $publisher --sku $sku --version $version
    

Here's a sample output:

PS C:\Users\azcli> az stack-hci-vm image create --custom-location $cl --name $mktplaceImage --os-type $ostype --resource-group $rg --publisher $publisher --offer $offer --sku $sku  --version $version

{
  "extendedLocation": { 
    "name": "/subscriptions/<Subscription ID>/resourceGroups/mylocal-rg/providers/Microsoft.ExtendedLocation/customLocations/mylocal-cl", 
    "type": "CustomLocation" 
  }, 
  "id": "/subscriptions/<Subscription ID>/resourceGroups/mylocal-rg/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/myhci-marketplaceimage", 
  "location": "eastus", 
  "name": "myhci-marketplaceimage", 
  "properties": { 
    "cloudInitDataSource": null, 
    "containerId": null, 
    "hyperVGeneration": null, 
    "identifier": { 
      "offer": "windowsserver", 
      "publisher": "microsoftwindowsserver", 
      "sku": "2019-datacenter-gensecond" 
    }, 
    "osType": "Windows", 
    "provisioningState": "Succeeded", 
    "status": { 
      "downloadStatus": { 
        "downloadSizeInMb": 10832 
      }, 
      "errorCode": "", 
      "errorMessage": "", 
      "progressPercentage": 100, 
      "provisioningStatus": { 
        "operationId": "13efc468-7473-429f-911b-858c1e6fc1d5*B11A62EE76B08EF194F8293CDD40F7BC71BFB93255D5A99DD11B4167690752D9", 
        "status": "Succeeded" 
      } 
    },
    "version": {
      "name": "17763.7922.251021",
      "properties": {
        "storageProfile": {
          "osDiskImage": {
            "sizeInMB": 130050
          }
        }
      }
    }
  },
  "resourceGroup": "mylocal-rg", 
  "systemData": { 
    "createdAt": "2024-09-23T18:53:13.734389+00:00", 
    "createdBy": "[email protected]", 
    "createdByType": "User", 
    "lastModifiedAt": "2024-09-23T19:06:07.532276+00:00", 
    "lastModifiedBy": "319f651f-7ddb-4fc6-9857-7aef9250bd05", 
    "lastModifiedByType": "Application" 
  },
  "tags": null, 
  "type": "microsoft.azurestackhci/marketplacegalleryimages" 
}

For more information on this CLI command, see az stack-hci-vm image.

Update VM image

Important

The latest updates may take some time to reflect on your VM images as more validations are performed.

When a new updated image is available in Azure Marketplace, the VM images on your Azure Local become outdated and you should update them. The update operation isn't an in-place update of the image. Instead, you can see which VM images have an updated image available, and select images to update. After you update, the create VM image operation uses the new updated image.

To update a VM image, use the following steps in Azure portal.

  1. To check if an update is available, select a VM image from the list view.

    Screenshot showing that a VM image update is available for download.

    In the Overview pane, you see a banner that shows the new VM image available for download, if one is available. To update to the new image, select the arrow icon.

    Screenshot showing a new VM image available for download in VM image details.

  2. Review image details and then select Review and create. By default, the new image uses the same resource group and instance details as the previous image.

    The name for the new image is incremented based on the name of the previous image. For example, an existing image named winServer2022-01 has an updated image named winServer2022-02.

    Screenshot showing the Review and create dialog for a new VM image.

  3. To complete the operation, select Create.

    Screenshot showing the Create image dialog for a new VM image.

    After the new VM image is created, create a VM using the new image and verify that the VM works properly. After verification, you can delete the old VM image.

Next steps