Enable SecurityProfile (TrustedLaunch) for Virtual Machines

I want to enable SecurityProfile (TrustedLaunch) for Virtual Machines.
I used Packer 1.8.7 and in packer.json file in the builder section, I declare like this:

"builders": [
      "name": "rhel79",
      "image_publisher": "RedHat",
      "image_offer": "RHEL",
      "image_sku": "79-gen2",
      "os_type": "Linux",
      "ssh_username": "{{user `ssh_user`}}",
      "ssh_password": "{{user `ssh_pass`}}",
      "ssh_pty": "{{user `ssh_pty`}}",
      "tenant_id": "{{user `tenant_id`}}",
      "subscription_id": "{{user `subscription_id`}}",
      "client_id": "{{user `client_id`}}",
      "client_secret": "{{user `client_secret`}}",
      "virtual_network_name": "{{user `packer_vnet`}}",
      "virtual_network_resource_group_name": "{{user `packer_vnet_resource_group`}}",
      "virtual_network_subnet_name": "{{user `packer_subnet`}}",
      "location": "{{user `packer_location`}}",
      "vm_size": "{{user `vm_size`}}",
      "resource_group_name": "{{user `packer_storage_account_resource_group`}}",
      "storage_account": "{{user `packer_storage_account`}}",
      "capture_container_name": "{{user `capture_container_name`}}",
      "capture_name_prefix": "{{user `capture_name_prefix`}}",
      "type": "azure-arm",
      "secure_boot_enabled": "true",
      "vtpm_enabled": "true"

However, I encountered the following error:

  • unknown configuration key: ‘“secure_boot_enabled”’
  • unknown configuration key: ‘“vtpm_enabled”’

Does anyone have an idea about the error?

I have run into the same issue. Did you manage to resolve it?

Hi, I think I was able to find the issue. It seems if your destination is not an Azure Compute Gallery you cannot enable secure_boot and vtpm, more details here:

Also I had to convert my json template to HCL and install Packer Azure plugin