Issue installing AIDE

I am using Packer to build an Azure Linux image using azure-arm deployment
image_publisher: canonical
image_offer: 0001-com-ubuntu-server-focal
image_sku: 20_04-lts

The deployment includes AIDE (version 0.16.1) I am using a bash script to install AIDE during the image build process, I receive the following error:

Build ‘azure-arm’ errored: Script disconnected unexpectedly. If you expected your script to disconnect, i.e. from a restart,
you can try adding "expect_disconnect": true or "valid_exit_codes": [0, 2300218] to the shell provisioner parameters.

AIDE bash script
#!/bin/bash -x
apt-get update -y
DEBIAN_FRONTEND=noninteractive apt-get -y install aide


I execute the script manually and AIDE successfully installs, however, it does take a while to install.