Centos8 image creation through packer on azure results in to errors

Can somebody tell me what I am doing wrong here as I am unable to create the image? actually the commands, when I run on my host Centos machine, works fine but when I execute the same commands through packer result into error.

JSON file:

  "builders": [{
    "type": "azure-arm",
    "client_id": "{{user `azure-client-id`}}",
    "client_secret": "{{user `azure-client-secret`}}",
    "tenant_id": "{{user `azure-tenant-id`}}",
    "subscription_id": "{{user `azure-subscription-id`}}",
    "managed_image_resource_group_name": "{{user `azure-resource-group`}}",
    "managed_image_name": "CentOS8-Packer",
    "os_type": "Linux",
    "image_publisher": "OpenLogic",
    "image_offer": "CentOS",
    "image_sku": "8_2-gen2",

    "location": "{{user `azure-region`}}",
    "vm_size": "{{user `vm-size`}}"

  "provisioners": [
      "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
      "type": "shell"

ami-script.sh content:

#!/bin/bash -e
dnf update -y
dnf install terminator xrdp -y


Hi there these look like Linux errors and not Packer or Azure errors.

The package not found errors are most likely due to the packages not being available in any of the configured software repositories. I recommend you check your local system to see what repositories terminator and xrdp are in and enable the repository on the Azure instance.

As for the selinux errors “Operation not permitted”. Does setting selinux to permissive mode setenforce 0 before the update help?