Issues creating Windows Server VM (for Azure Data Factory self-hosted IR) from custom image built using Packer

27 Views Asked by At

I'm having a few issues creating a VM using a custom image I created with Packer.

I'm using Packer to build an image for an Azure Data Factory self-hosted integration runtime. My Packer template will download the software (which is over 900 MB - part of the reason I'm building a custom image) and then upload a PowerShell registration script to simplify registration during the subsequent Terraform build.

There's some prerequisites for the image, such as:

  • Supported version of windows
  • 4 cores
  • 8 GB of RAM
  • 80 GB of available hard drive space
  • etc.

My Packer template is here and variables here. The key variables are:

location               = "Australia East"
source_image_publisher = "MicrosoftWindowsServer"
source_image_offer     = "WindowsServer"
source_image_sku       = "2022-datacenter"
vm_size                = "Standard_D4ls_v5"
adf_shir_msi_url       = "https://download.microsoft.com/download/E/4/7/E4771905-1079-445B-8BF9-8A1A075D8A10/IntegrationRuntime_5.36.8726.3.msi"

Anyways, the packer build succeeds, but when I try to create a VM using my custom image (either manually in the Azure portal or using Terraform), it fails. The error I'm getting isn't overly helpful:

{
  "code": "DeploymentFailed",
  "target": "/subscriptions/ec0dc0a5-5f82-49e9-b568-1863ea08ef7b/resourceGroups/adhoc/providers/Microsoft.Resources/deployments/CreateVm-adf-shir-20240312171357",
  "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
  "details": [
    {
      "code": "ResourceDeploymentFailure",
      "target": "/subscriptions/ec0dc0a5-5f82-49e9-b568-1863ea08ef7b/resourceGroups/adhoc/providers/Microsoft.Compute/virtualMachines/test",
      "message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'."
    }
  ]
}

Just wondering if there's something obvious that I'm doing wrong. FWIW I've got linux VMs from custom images working, but this one is Windows.

The other (perhaps related) thing is when I use my own custom image, I'm required to specify a license type, but I don't need to do this for non custom Windows images. Not sure exactly why this is, but might be part of the issue...

enter image description here

1

There are 1 best solutions below

0
Ryan.Bartsch On

I managed to get this working with Windows Server 2019

source_image_publisher = "MicrosoftWindowsServer"
source_image_offer     = "WindowsServer"
source_image_sku       = "2019-datacenter"

Seems to be an issue for any Windows Server 2022 SKUs e.g. 2022-datacenter, 2022-datacenter-azure-edition-hotpatch, etc.