Packer - wrong hostname and user

Hi, i have a simple script that needs to log current user and hostname to a .log file, but i want to use the username and hostname of the instance created, not the username of the resources that gets created automatically by packer.

If a launch an EC2 on AWS, it works (the username that gets logged is ec2-user with the correct hostname), when i launch a VM on Azure, the username that gets logged is packer (it should be azureuser) and the hostname is some weird stuff in the form: